Class: SyntaxTree::WordsBeg
Overview
WordsBeg represents the beginning of a string literal array with interpolation.
%W[one two three]
In the snippet above, a WordsBeg would be created with the value of “%W[”. Note that these kinds of arrays can start with a lot of different delimiter types (e.g., %W| or %W<).
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- String
-
the start of the word literal array.
Attributes inherited from Node
Instance Method Summary collapse
- #===(other) ⇒ Object
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #copy(value: nil, location: nil) ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
-
#initialize(value:, location:) ⇒ WordsBeg
constructor
A new instance of WordsBeg.
Methods inherited from Node
#construct_keys, #format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ WordsBeg
Returns a new instance of WordsBeg.
11975 11976 11977 11978 |
# File 'lib/syntax_tree/node.rb', line 11975 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the start of the word literal array
11973 11974 11975 |
# File 'lib/syntax_tree/node.rb', line 11973 def value @value end |
Instance Method Details
#===(other) ⇒ Object
12001 12002 12003 |
# File 'lib/syntax_tree/node.rb', line 12001 def ===(other) other.is_a?(WordsBeg) && value === other.value end |
#accept(visitor) ⇒ Object
11980 11981 11982 |
# File 'lib/syntax_tree/node.rb', line 11980 def accept(visitor) visitor.visit_words_beg(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
11984 11985 11986 |
# File 'lib/syntax_tree/node.rb', line 11984 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
11988 11989 11990 11991 11992 11993 |
# File 'lib/syntax_tree/node.rb', line 11988 def copy(value: nil, location: nil) WordsBeg.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
11997 11998 11999 |
# File 'lib/syntax_tree/node.rb', line 11997 def deconstruct_keys(_keys) { value: value, location: location } end |