Receive UDP/IP packets from the given sockets. For each packet received, the block is called.
The block receives msg and msg_src. msg is a string which is the payload of the received packet. msg_src is a Socket::UDPSource
object which is used for reply.
Socket.udp_server_loop
can be implemented using this method as follows.
udp_server_sockets(host, port) {|sockets| loop { readable, _, _ = IO.select(sockets) udp_server_recv(readable) {|msg, msg_src| ... } } }
creates a UNIX server socket on path
If no block given, it returns a listening socket.
If a block is given, it is called with the socket and the block value is returned. When the block exits, the socket is closed and the socket file is removed.
socket = Socket.unix_server_socket("/tmp/s") p socket #=> #<Socket:fd 3> p socket.local_address #=> #<Addrinfo: /tmp/s SOCK_STREAM> Socket.unix_server_socket("/tmp/sock") {|s| p s #=> #<Socket:fd 3> p s.local_address #=> # #<Addrinfo: /tmp/sock SOCK_STREAM> }
Returns WIN32OLE
object for a specific dispatch or dual interface specified by iid.
ie = WIN32OLE.new('InternetExplorer.Application') ie_web_app = ie.ole_query_interface('{0002DF05-0000-0000-C000-000000000046}') # => WIN32OLE object for dispinterface IWebBrowserApp
Returns the value of the local variable symbol
.
def foo a = 1 binding.local_variable_get(:a) #=> 1 binding.local_variable_get(:b) #=> NameError end
This method is the short version of the following code:
binding.eval("#{symbol}")
Yields each frame of the current execution stack as a backtrace location object.
obj can be an instance of InternalObjectWrapper
.
Note that you should not use this method in your application.
Verify internal consistency.
This method is implementation specific. Now this method checks generational consistency if RGenGC is supported.
Returns the size of memory allocated by malloc().
Only available if ruby was built with CALC_EXACT_MALLOC_SIZE
.
Verify compaction reference consistency.
This method is implementation specific. During compaction, objects that were moved are replaced with T_MOVED objects. No object should have a reference to a T_MOVED object after compaction.
This function expands the heap to ensure room to move all objects, compacts the heap to make sure everything moves, updates all references, then performs a full GC. If any object contains a reference to a T_MOVED object, that object should be pushed on the mark stack, and will make a SEGV.
The file name and line number of the caller of the caller of this method.
depth
is how many layers up the call stack it should go.
e.g.,
def a; Gem.location_of_caller
; end a #=> [“x.rb”, 2] # (it’ll vary depending on file name and line number)
def b; c; end def c; Gem.location_of_caller(2)
; end b #=> [“x.rb”, 6] # (it’ll vary depending on file name and line number)
Returns the latest release version of RubyGems.
Like Enumerable#select
, but chains operation to be lazy-evaluated.
Generates a random prime number of bit length bits. If safe is set to true
, generates a safe prime. If add is specified, generates a prime that fulfills condition p % add = rem
.
Translates and dispatches Windows message.
Returns the X509 certificate chain (an array of strings) for the session’s socket peer, or nil
if none.
Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc
.
attr_reader operator_loc
: Location
attr_reader operator_loc
: Location
Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc
.