Returns every spec that has the given full_name
Returns true if the content needs to be encoded in base64.
Returns the modulo after division of float
by other
.
6543.21.modulo(137) #=> 104.21000000000004 6543.21.modulo(137.24) #=> 92.92999999999961
Returns garbage collector generation for the given object
.
class B include ObjectSpace def foo trace_object_allocations do obj = Object.new p "Generation is #{allocation_generation(obj)}" end end end B.new.foo #=> "Generation is 3"
See ::trace_object_allocations
for more information and examples.
Set
Intersection — Returns a new array containing unique elements common to self
and other_ary
s. Order is preserved from the original array.
It compares elements using their hash
and eql?
methods for efficiency.
[ 1, 1, 3, 5 ].intersection([ 3, 2, 1 ]) # => [ 1, 3 ] [ "a", "b", "z" ].intersection([ "a", "b", "c" ], [ "b" ]) # => [ "b" ] [ "a" ].intersection #=> [ "a" ]
See also Array#&
.
Searches sep or pattern (regexp) in the string and returns the part before it, the match, and the part after it. If it is not found, returns two empty strings and str.
"hello".partition("l") #=> ["he", "l", "lo"] "hello".partition("x") #=> ["hello", "", ""] "hello".partition(/.l/) #=> ["h", "el", "lo"]
Searches sep or pattern (regexp) in the string from the end of the string, and returns the part before it, the match, and the part after it. If it is not found, returns two empty strings and str.
"hello".rpartition("l") #=> ["hel", "l", "o"] "hello".rpartition("x") #=> ["", "", "hello"] "hello".rpartition(/.l/) #=> ["he", "ll", "o"]
Opens a new transaction for the data store. Code executed inside a block passed to this method may read and write data to and from the data store file.
At the end of the block, changes are committed to the data store automatically. You may exit the transaction early with a call to either PStore#commit
or PStore#abort
. See those methods for details about how changes are handled. Raising an uncaught Exception
in the block is equivalent to calling PStore#abort
.
If read_only is set to true
, you will only be allowed to read from the data store during the transaction and any attempts to change the data will raise a PStore::Error
.
Note that PStore
does not support nested transactions.
Returns two arrays, the first containing the elements of enum for which the block evaluates to true, the second containing the rest.
If no block is given, an enumerator is returned instead.
(1..6).partition { |v| v.even? } #=> [[2, 4, 6], [1, 3, 5]]
The standard configuration object for gems.
Use the given configuration object (which implements the ConfigFile
protocol) as the standard configuration object.
Returns the fractional part of the second.
DateTime.new(2001,2,3,4,5,6.5).sec_fraction #=> (1/2)
Compiled instruction sequence represented by a RubyVM::InstructionSequence
instance on the :script_compiled
event.
Note that this method is MRI specific.