Delegates to the cached_start_code_units_offset
of the associated location object.
Delegates to the cached_end_code_units_offset
of the associated location object.
Delegates to the cached_start_code_units_column
of the associated location object.
Delegates to the cached_end_code_units_column
of the associated location object.
The start offset from the start of the file in code units using the given cache to fetch or calculate the value.
The end offset from the start of the file in code units using the given cache to fetch or calculate the value.
The start column in code units using the given cache to fetch or calculate the value.
The end column in code units using the given cache to fetch or calculate the value.
Returns every spec that has the given full_name
Create a new ConstantPathAndWriteNode
node.
Create a new ConstantPathOperatorWriteNode
node.
Create a new ConstantPathOrWriteNode
node.
@foo += bar ^^^^^^^^^^^
@foo &&= bar ^^^^^^^^^^^^
@foo ||= bar ^^^^^^^^^^^^
@foo += bar ^^^^^^^^^^^
@foo &&= bar ^^^^^^^^^^^^
@foo ||= bar ^^^^^^^^^^^^
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.
Returns a new array containing each element in self
that is eql?
to at least one element in each of the given other_arrays
; duplicates are omitted:
[0, 0, 1, 1, 2, 3].intersection([0, 1, 2], [0, 1, 3]) # => [0, 1]
Each element must correctly implement method hash
.
Order from self
is preserved:
[0, 1, 2].intersection([2, 1, 0]) # => [0, 1, 2]
Returns a copy of self
if no arguments are given.
Related: see Methods for Combining.
Returns a 3-element array of substrings of self
.
Matches a pattern against self
, scanning from the beginning. The pattern is:
string_or_regexp
itself, if it is a Regexp
.
Regexp.quote(string_or_regexp)
, if string_or_regexp
is a string.
If the pattern is matched, returns pre-match, first-match, post-match:
'hello'.partition('l') # => ["he", "l", "lo"] 'hello'.partition('ll') # => ["he", "ll", "o"] 'hello'.partition('h') # => ["", "h", "ello"] 'hello'.partition('o') # => ["hell", "o", ""] 'hello'.partition(/l+/) #=> ["he", "ll", "o"] 'hello'.partition('') # => ["", "", "hello"] 'тест'.partition('т') # => ["", "т", "ест"] 'こんにちは'.partition('に') # => ["こん", "に", "ちは"]
If the pattern is not matched, returns a copy of self
and two empty strings:
'hello'.partition('x') # => ["hello", "", ""]
Related: String#rpartition
, String#split
.