Class: SyntaxTree::IVar
Overview
IVar represents an instance variable literal.
@variable
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#value ⇒ Object
readonly
- String
-
the name of the instance variable.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, location:, comments: []) ⇒ IVar
constructor
A new instance of IVar.
Methods inherited from Node
Constructor Details
#initialize(value:, location:, comments: []) ⇒ IVar
Returns a new instance of IVar.
5084 5085 5086 5087 5088 |
# File 'lib/syntax_tree/node.rb', line 5084 def initialize(value:, location:, comments: []) @value = value @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
5082 5083 5084 |
# File 'lib/syntax_tree/node.rb', line 5082 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the name of the instance variable
5079 5080 5081 |
# File 'lib/syntax_tree/node.rb', line 5079 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
5090 5091 5092 |
# File 'lib/syntax_tree/node.rb', line 5090 def accept(visitor) visitor.visit_ivar(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
5094 5095 5096 |
# File 'lib/syntax_tree/node.rb', line 5094 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
5100 5101 5102 |
# File 'lib/syntax_tree/node.rb', line 5100 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
5104 5105 5106 |
# File 'lib/syntax_tree/node.rb', line 5104 def format(q) q.text(value) end |