Receives a message via unixsocket.
maxlen is the maximum number of bytes to receive.
flags should be a bitwise OR of Socket::MSG_* constants.
outbuf will contain only the received data after the method call even if it is not empty at the beginning.
s1 = Socket.new(:UNIX, :DGRAM, 0) s1_ai = Addrinfo.unix("/tmp/sock1") s1.bind(s1_ai) s2 = Socket.new(:UNIX, :DGRAM, 0) s2_ai = Addrinfo.unix("/tmp/sock2") s2.bind(s2_ai) s3 = UNIXSocket.for_fd(s2.fileno) s1.send "a", 0, s2_ai p s3.recvfrom(10) #=> ["a", ["AF_UNIX", "/tmp/sock1"]]
Creates a pair of sockets connected to each other.
socktype should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
protocol should be a protocol defined in the domain. 0 is default protocol for the domain.
s1, s2 = UNIXSocket.pair s1.send "a", 0 s1.send "b", 0 p s2.recv(10) #=> "ab"
Returns current locale id (lcid). The default locale is WIN32OLE::LOCALE_SYSTEM_DEFAULT
.
lcid = WIN32OLE.locale
Sets current locale id (lcid).
WIN32OLE.locale = 1033 # set locale English(U.S) obj = WIN32OLE_VARIANT.new("$100,000", WIN32OLE::VARIANT::VT_CY)
Searches through the hash comparing obj with the key using ==
. Returns the key-value pair (two elements array) or nil
if no match is found. See Array#assoc
.
h = {"colors" => ["red", "blue", "green"], "letters" => ["a", "b", "c" ]} h.assoc("letters") #=> ["letters", ["a", "b", "c"]] h.assoc("foo") #=> nil
Searches through the hash comparing obj with the value using ==
. Returns the first key-value pair (two-element array) that matches. See also Array#rassoc
.
a = {1=> "one", 2 => "two", 3 => "three", "ii" => "two"} a.rassoc("two") #=> [2, "two"] a.rassoc("four") #=> nil
Returns an Array of the name and value of the environment variable with name
or nil
if the name cannot be found.
Returns an Array of the name and value of the environment variable with value
or nil
if the value cannot be found.
Print an argument or list of arguments to the default output stream
cgi = CGI.new cgi.print # default: cgi.print == $DEFAULT_OUTPUT.print
Returns true
iff the current severity level allows for the printing of ERROR
messages.
Returns true
if fix
is zero.
Creates a matrix where rows
is an array of arrays, each of which is a row of the matrix. If the optional argument copy
is false, use the given arrays as the internal structure of the matrix without copying.
Matrix.rows([[25, 93], [-1, 66]]) => 25 93 -1 66
Returns row vector number i
of the matrix as a Vector
(starting at 0 like an array). When a block is given, the elements of that vector are iterated.
Returns true
if this is a matrix with only zero elements
Returns a matrix with entries rounded to the given precision (see Float#round
)
Returns a vector with entries rounded to the given precision (see Float#round
)
Parses environment variable env
or its uppercase with splitting like a shell.
env
defaults to the basename of the program.
Parses environment variable env
or its uppercase with splitting like a shell.
env
defaults to the basename of the program.
Groups line break hints added in the block. The line break hints are all to be used or not.
If indent
is specified, the method call is regarded as nested by nest(indent) { … }.
If open_obj
is specified, text open_obj, open_width
is called before grouping. If close_obj
is specified, text close_obj, close_width
is called after grouping.
Returns true if value
is a prime number, else returns false.
value
an arbitrary integer to be checked.
generator
optional. A pseudo-prime generator.
Returns the names of all object hierarchies currently in the store.
WARNING: This method is only valid in a PStore#transaction
. It will raise PStore::Error
if called at any other time.