Results for: "remove_const"

No documentation available

When a block given, iterates backwards over the elements of self, passing, in reverse order, each element to the block; returns self:

a = []
[0, 1, 2].reverse_each {|element| a.push(element) }
a # => [2, 1, 0]

Allows the array to be modified during iteration:

a = ['a', 'b', 'c']
a.reverse_each {|element| a.clear if element.start_with?('b') }
a # => []

When no block given, returns a new Enumerator.

Related: see Methods for Iterating.

Returns true if the named file is readable by the real user and group id of this process. See access(3).

Note that some OS-level security features may cause this to return true even though the file is not readable by the real user/group.

When this module is prepended in another, Ruby calls prepend_features in this module, passing it the receiving module in mod. Ruby’s default implementation is to overlay the constants, methods, and module variables of this module to mod if this module has not already been added to mod or one of its ancestors. See also Module#prepend.

Returns an array of all modules used in the current scope. The ordering of modules in the resulting array is not defined.

module A
  refine Object do
  end
end

module B
  refine Object do
  end
end

using A
using B
p Module.used_refinements

produces:

[#<refinement:Object@B>, #<refinement:Object@A>]

With a block given, passes each element of self to the block in reverse order:

a = []
(1..4).reverse_each {|element| a.push(element) } # => 1..4
a # => [4, 3, 2, 1]

a = []
(1...4).reverse_each {|element| a.push(element) } # => 1...4
a # => [3, 2, 1]

With no block given, returns an enumerator.

See FileTest.readable_real?.

Returns true if the referenced object is still alive.

Receive only a specific message.

Instead of Ractor.receive, Ractor.receive_if can be given a pattern (or any filter) in a block and you can choose the messages to accept that are available in your ractor’s incoming queue.

r = Ractor.new do
  p Ractor.receive_if{|msg| msg.match?(/foo/)} #=> "foo3"
  p Ractor.receive_if{|msg| msg.match?(/bar/)} #=> "bar1"
  p Ractor.receive_if{|msg| msg.match?(/baz/)} #=> "baz2"
end
r << "bar1"
r << "baz2"
r << "foo3"
r.take

This will output:

foo3
bar1
baz2

If the block returns a truthy value, the message is removed from the incoming queue and returned. Otherwise, the message remains in the incoming queue and the next messages are checked by the given block.

If there are no messages left in the incoming queue, the method will block until new messages arrive.

If the block is escaped by break/return/exception/throw, the message is removed from the incoming queue as if a truthy value had been returned.

r = Ractor.new do
  val = Ractor.receive_if{|msg| msg.is_a?(Array)}
  puts "Received successfully: #{val}"
end

r.send(1)
r.send('test')
wait
puts "2 non-matching sent, nothing received"
r.send([1, 2, 3])
wait

Prints:

2 non-matching sent, nothing received
Received successfully: [1, 2, 3]

Note that you can not call receive/receive_if in the given block recursively. You should not do any tasks in the block other than message filtration.

Ractor.current << true
Ractor.receive_if{|msg| Ractor.receive}
#=> `receive': can not call receive/receive_if recursively (Ractor::Error)

same as Ractor.receive_if

With a block given, calls the block with each element, but in reverse order; returns self:

a = []
(1..4).reverse_each {|element| a.push(-element) } # => 1..4
a # => [-4, -3, -2, -1]

a = []
%w[a b c d].reverse_each {|element| a.push(element) }
# => ["a", "b", "c", "d"]
a # => ["d", "c", "b", "a"]

a = []
h.reverse_each {|element| a.push(element) }
# => {:foo=>0, :bar=>1, :baz=>2}
a # => [[:baz, 2], [:bar, 1], [:foo, 0]]

With no block given, returns an Enumerator.

Returns true if the named file is readable by the real user and group id of this process. See access(3).

Note that some OS-level security features may cause this to return true even though the file is not readable by the real user/group.

No documentation available

Adds a hook that will get run before Gem::Specification.reset is run.

Sets the remote network access for all composed sets.

The version requirement for this dependency request

No documentation available

The column number in the source code where this AST’s text began.

The column number in the source code where this AST’s text ended.

The column number in the source code where this AST’s text began.

The column number in the source code where this AST’s text ended.

Removes sessions in the internal cache that have expired at time.

No documentation available
No documentation available
No documentation available
Search took: 4ms  ·  Total Results: 3316