Returns true if sym
starts with one of the prefixes
given. Each of the prefixes
should be a String
or a Regexp
.
:hello.start_with?("hell") #=> true :hello.start_with?(/H/i) #=> true # returns true if one of the prefixes matches. :hello.start_with?("heaven", "hell") #=> true :hello.start_with?("heaven", "paradise") #=> false
Duplicates a StringScanner
object.
Replaces the entire contents of self
with the contents of other_hash
; returns self
:
h = {foo: 0, bar: 1, baz: 2} h.replace({bat: 3, bam: 4}) # => {:bat=>3, :bam=>4}
The version of the Marshal
format for your Ruby.
Get a single optional argument from the command line. If more than one argument is given, return only the first. Return nil if none are given.
Called before each event with line/column information.
Parse and return a Time
from string
Returns a hash of default options used by the Ruby iseq compiler.
For details, see InstructionSequence.compile_option=
.
Sets the default values for various optimizations in the Ruby iseq compiler.
Possible values for options
include true
, which enables all options, false
which disables all options, and nil
which leaves all options unchanged.
You can also pass a Hash
of options
that you want to change, any options not present in the hash will be left unchanged.
Possible option names (which are keys in options
) which can be set to true
or false
include:
:inline_const_cache
:instructions_unification
:operands_unification
:peephole_optimization
:specialized_instruction
:stack_caching
:tailcall_optimization
Additionally, :debug_level
can be set to an integer.
These default options can be overwritten for a single run of the iseq compiler by passing any of the above values as the options
parameter to ::new
, ::compile
and ::compile_file
.