Class: SyntaxTree::RationalLiteral
Overview
RationalLiteral represents the use of a rational number literal.
1r
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#value ⇒ Object
readonly
- String
-
the rational 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: []) ⇒ RationalLiteral
constructor
A new instance of RationalLiteral.
Methods inherited from Node
Constructor Details
#initialize(value:, location:, comments: []) ⇒ RationalLiteral
Returns a new instance of RationalLiteral.
6496 6497 6498 6499 6500 |
# File 'lib/syntax_tree/node.rb', line 6496 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
6494 6495 6496 |
# File 'lib/syntax_tree/node.rb', line 6494 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the rational number literal
6491 6492 6493 |
# File 'lib/syntax_tree/node.rb', line 6491 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
6502 6503 6504 |
# File 'lib/syntax_tree/node.rb', line 6502 def accept(visitor) visitor.visit_rational(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
6506 6507 6508 |
# File 'lib/syntax_tree/node.rb', line 6506 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
6512 6513 6514 |
# File 'lib/syntax_tree/node.rb', line 6512 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
6516 6517 6518 |
# File 'lib/syntax_tree/node.rb', line 6516 def format(q) q.text(value) end |