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
#construct_keys, #format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ EmbVar
Returns a new instance of EmbVar.
4254 4255 4256 4257 |
# File 'lib/syntax_tree/node.rb', line 4254 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
[String] the # used in the string
4252 4253 4254 |
# File 'lib/syntax_tree/node.rb', line 4252 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
4259 4260 4261 |
# File 'lib/syntax_tree/node.rb', line 4259 def accept(visitor) visitor.visit_embvar(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
4263 4264 4265 |
# File 'lib/syntax_tree/node.rb', line 4263 def child_nodes [] end |
#deconstruct_keys(_keys) ⇒ Object
4269 4270 4271 |
# File 'lib/syntax_tree/node.rb', line 4269 def deconstruct_keys(_keys) { value: value, location: location } end |