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.
4934 4935 4936 4937 4938 |
# File 'lib/syntax_tree/node.rb', line 4934 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
4932 4933 4934 |
# File 'lib/syntax_tree/node.rb', line 4932 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the value of the imaginary number literal
4929 4930 4931 |
# File 'lib/syntax_tree/node.rb', line 4929 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
4940 4941 4942 |
# File 'lib/syntax_tree/node.rb', line 4940 def accept(visitor) visitor.visit_imaginary(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
4944 4945 4946 |
# File 'lib/syntax_tree/node.rb', line 4944 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
4950 4951 4952 |
# File 'lib/syntax_tree/node.rb', line 4950 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
4954 4955 4956 |
# File 'lib/syntax_tree/node.rb', line 4954 def format(q) q.text(value) end |