Helper method for grabbing elements from document
Like ‘take_while` except when it stops iterating, it also returns the line that caused it to stop
Returns the source encoding name as a string.
Returns the destination encoding name as a string.
Returns the source encoding name as a string.
Returns the destination encoding name as a string.
A pretty print for a pair of Hash
foo in bar ^^^^^^^^^^
foo => bar ^^^^^^^^^^
The line number in the source code where this AST’s text began.
The column number in the source code where this AST’s text began.
The line number in the source code where this AST’s text began.
The column number in the source code where this AST’s text began.
The default encoding for Ruby files is UTF-8.
Build a diagnostic from the given prism parse error.
Build a diagnostic from the given prism parse warning.
Verifies each certificate in chain
has signed the following certificate and is valid for the given time
.
Returns the element at offset index
.
With the single Integer
argument index
, returns the element at offset index
:
a = [:foo, 'bar', 2] a.fetch(1) # => "bar"
If index
is negative, counts from the end of the array:
a = [:foo, 'bar', 2] a.fetch(-1) # => 2 a.fetch(-2) # => "bar"
With arguments index
and default_value
, returns the element at offset index
if index is in range, otherwise returns default_value
:
a = [:foo, 'bar', 2] a.fetch(1, nil) # => "bar"
With argument index
and a block, returns the element at offset index
if index is in range (and the block is not called); otherwise calls the block with index and returns its return value:
a = [:foo, 'bar', 2] a.fetch(1) {|index| raise 'Cannot happen' } # => "bar" a.fetch(50) {|index| "Value for #{index}" } # => "Value for 50"