Class: SyntaxTree::EmbVar
Overview
EmbVar represents the use of shorthand interpolation for an instance, class, or global variable into a parent node that accepts string content (like a string or regular expression).
"#@variable"
In the example above, an EmbVar node represents the # because it forces
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- String
-
the # used in the string.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(value:, location:) ⇒ EmbVar
constructor
A new instance of EmbVar.
Methods inherited from Node
#format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ EmbVar
Returns a new instance of EmbVar.
3828 3829 3830 3831 |
# File 'lib/syntax_tree/node.rb', line 3828 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the # used in the string
3826 3827 3828 |
# File 'lib/syntax_tree/node.rb', line 3826 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
3833 3834 3835 |
# File 'lib/syntax_tree/node.rb', line 3833 def accept(visitor) visitor.visit_embvar(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
3837 3838 3839 |
# File 'lib/syntax_tree/node.rb', line 3837 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
3843 3844 3845 |
# File 'lib/syntax_tree/node.rb', line 3843 def deconstruct_keys(keys) { value: value, location: location } end |