Converts the contents of the database to an in-memory Hash
, then calls Hash#reject
with the specified code block, returning a new Hash
.
Replaces the contents of the database with the contents of the specified object. Takes any object which implements the each_pair
method, including Hash
and DBM
objects.
Converts the contents of the database to an array of [key, value] arrays, and returns it.
Returns the system-dependent integer status of self
:
`cat /nop` $?.to_i # => 256
Returns a string representation of self
:
`cat /nop` $?.to_s # => "pid 1262141 exit 1"
Returns the least significant eight bits of the return code of the process if it has exited; nil
otherwise:
`exit 99` $?.exitstatus # => 99
Receive a message to the port (which was sent there by Port#send
).
port = Ractor::Port.new r = Ractor.new port do |port| port.send('message1') end v1 = port.receive puts "Received: #{v1}" r.join # Here will be printed: "Received: message1"
The method blocks if the message queue is empty.
port = Ractor::Port.new r = Ractor.new port do |port| wait puts "Still not received" port.send('message1') wait puts "Still received only one" port.send('message2') end puts "Before first receive" v1 = port.receive puts "Received: #{v1}" v2 = port.receive puts "Received: #{v2}" r.join
Output:
Before first receive Still not received Received: message1 Still received only one Received: message2
If close_incoming was called on the ractor, the method raises Ractor::ClosedError
if there are no more messages in the message queue:
port = Ractor::Port.new port.close port.receive #=> raise Ractor::ClosedError
Wakes up all threads waiting for this lock.
The queue can’t be frozen, so this method raises an exception:
Thread::Queue.new.freeze # Raises TypeError (cannot freeze #<Thread::Queue:0x...>)
Returns the replacement string.
ec = Encoding::Converter.new("euc-jp", "us-ascii") p ec.replacement #=> "?" ec = Encoding::Converter.new("euc-jp", "utf-8") p ec.replacement #=> "\uFFFD"
Sets the replacement string.
ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace) ec.replacement = "<undef>" p ec.convert("a \u3042 b") #=> "a <undef> b"
Resets the digest to the initial state and returns self.
This method is overridden by each implementation subclass.
If none is given, returns the resulting hash value of the digest, keeping the digest’s state.
If a string is given, returns the hash value for the given string, resetting the digest to the initial state before and after the process.
Returns the resulting hash value and resets the digest to the initial state.
If none is given, returns the resulting hash value of the digest in a hex-encoded form, keeping the digest’s state.
If a string is given, returns the hash value for the given string in a hex-encoded form, resetting the digest to the initial state before and after the process.
Returns the resulting hash value in a hex-encoded form and resets the digest to the initial state.
Returns digest_obj.hexdigest().
If none is given, returns the resulting hash value of the digest in a base64 encoded form, keeping the digest’s state.
If a string
is given, returns the hash value for the given string
in a base64 encoded form, resetting the digest to the initial state before and after the process.
In either case, the return value is properly padded with ‘=’ and contains no line feeds.
Returns the resulting hash value and resets the digest to the initial state.
Get the next 8bit byte. Raises EOFError
on EOF
Reads size bytes from the stream. If buf is provided it must reference a string which will receive the data.
See IO#read
for full details.
Reads at most maxlen bytes from the stream. If buf is provided it must reference a string which will receive the data.
See IO#readpartial
for full details.
Reads a line from the stream which is separated by eol.
Raises EOFError
if at end of file.
Reads a one-character string from the stream. Raises an EOFError
at end of file.