Calls the block once for each element, passing both the element and the given object:
(1..4).each_with_object([]) {|i, a| a.push(i**2) } # => [1, 4, 9, 16] {foo: 0, bar: 1, baz: 2}.each_with_object({}) {|(k, v), h| h[v] = k } # => {0=>:foo, 1=>:bar, 2=>:baz}
With no block given, returns an Enumerator
.
Attempts to enter exclusive section. Returns false
if lock fails.
For backward compatibility
Ensures that the MonitorMixin
is owned by the current thread, otherwise raises an exception.
Glob pattern for require-able plugin suffixes.
Suffixes for dynamic library require-able paths.
Clear default gem related variables. It is for test
Finds the user’s config file
The default signing key path
Like URI.encode_www_form_component
, except that ' '
(space) is encoded as '%20'
(instead of '+'
).
Like URI.decode_www_form_component
, except that '+'
is preserved.
Should be implemented by a extended class.
tsort_each_node
is used to iterate for all nodes over a graph.
Should be implemented by a extended class.
tsort_each_child
is used to iterate for child nodes of node.
Visit one side of an alias global variable node.
Returns the string that is used to insert a space between the tokens in a JSON
string.
Sets space to the string that is used to insert a space between the tokens in a JSON
string.
Blocks can have a special set of parameters that automatically expand when given arrays if they have a single required parameter and no other parameters.
Writes data
onto the IO
, raising a FileOverflow
exception if the number of bytes will be more than limit