Desugar ‘x ||= y` to `defined?(x) ? x : x = y`
Dispatch enter and leave events for ClassVariableTargetNode
nodes and continue walking the tree.
Dispatch enter and leave events for GlobalVariableTargetNode
nodes and continue walking the tree.
Dispatch enter and leave events for InstanceVariableTargetNode
nodes and continue walking the tree.
Dispatch enter and leave events for KeywordRestParameterNode
nodes and continue walking the tree.
Dispatch enter and leave events for LocalVariableTargetNode
nodes and continue walking the tree.
Dispatch enter and leave events for NoKeywordsParameterNode
nodes and continue walking the tree.
Dispatch enter and leave events for OptionalKeywordParameterNode
nodes and continue walking the tree.
Dispatch enter and leave events for RequiredKeywordParameterNode
nodes and continue walking the tree.
Copy a OptionalKeywordParameterNode
node
Copy a RequiredKeywordParameterNode
node
Parses the most indented lines into blocks that are marked and added to the frontier
Returns an array of the grapheme clusters in self
(see Unicode Grapheme Cluster Boundaries):
s = "\u0061\u0308-pqr-\u0062\u0308-xyz-\u0063\u0308" # => "ä-pqr-b̈-xyz-c̈" s.grapheme_clusters # => ["ä", "-", "p", "q", "r", "-", "b̈", "-", "x", "y", "z", "-", "c̈"]
Returns whether self
starts with any of the given string_or_regexp
.
Matches patterns against the beginning of self
. For each given string_or_regexp
, the pattern is:
string_or_regexp
itself, if it is a Regexp
.
Regexp.quote(string_or_regexp)
, if string_or_regexp
is a string.
Returns true
if any pattern matches the beginning, false
otherwise:
'hello'.start_with?('hell') # => true 'hello'.start_with?(/H/i) # => true 'hello'.start_with?('heaven', 'hell') # => true 'hello'.start_with?('heaven', 'paradise') # => false 'тест'.start_with?('т') # => true 'こんにちは'.start_with?('こ') # => true
Related: String#end_with?
.