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
Constructor Details
#initialize(value:, location:, comments: []) ⇒ Imaginary
Returns a new instance of Imaginary.
5457 5458 5459 5460 5461 |
# File 'lib/syntax_tree/node.rb', line 5457 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
5455 5456 5457 |
# File 'lib/syntax_tree/node.rb', line 5455 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the value of the imaginary number literal
5452 5453 5454 |
# File 'lib/syntax_tree/node.rb', line 5452 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
5463 5464 5465 |
# File 'lib/syntax_tree/node.rb', line 5463 def accept(visitor) visitor.visit_imaginary(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
5467 5468 5469 |
# File 'lib/syntax_tree/node.rb', line 5467 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
5473 5474 5475 |
# File 'lib/syntax_tree/node.rb', line 5473 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
5477 5478 5479 |
# File 'lib/syntax_tree/node.rb', line 5477 def format(q) q.text(value) end |