Class: SyntaxTree::Imaginary
Overview
Imaginary represents an imaginary number literal.
1i
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#value ⇒ Object
readonly
- String
-
the value of the imaginary number literal.
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: []) ⇒ Imaginary
constructor
A new instance of Imaginary.
Methods inherited from Node
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:, comments: []) ⇒ Imaginary
Returns a new instance of Imaginary.
5626 5627 5628 5629 5630 |
# File 'lib/syntax_tree/node.rb', line 5626 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
5624 5625 5626 |
# File 'lib/syntax_tree/node.rb', line 5624 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the value of the imaginary number literal
5621 5622 5623 |
# File 'lib/syntax_tree/node.rb', line 5621 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
5632 5633 5634 |
# File 'lib/syntax_tree/node.rb', line 5632 def accept(visitor) visitor.visit_imaginary(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
5636 5637 5638 |
# File 'lib/syntax_tree/node.rb', line 5636 def child_nodes [] end |
#deconstruct_keys(_keys) ⇒ Object
5642 5643 5644 |
# File 'lib/syntax_tree/node.rb', line 5642 def deconstruct_keys(_keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
5646 5647 5648 |
# File 'lib/syntax_tree/node.rb', line 5646 def format(q) q.text(value) end |