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.
7038 7039 7040 7041 7042 |
# File 'lib/syntax_tree/node.rb', line 7038 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
7036 7037 7038 |
# File 'lib/syntax_tree/node.rb', line 7036 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the rational number literal
7033 7034 7035 |
# File 'lib/syntax_tree/node.rb', line 7033 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
7044 7045 7046 |
# File 'lib/syntax_tree/node.rb', line 7044 def accept(visitor) visitor.visit_rational(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7048 7049 7050 |
# File 'lib/syntax_tree/node.rb', line 7048 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
7054 7055 7056 |
# File 'lib/syntax_tree/node.rb', line 7054 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
7058 7059 7060 |
# File 'lib/syntax_tree/node.rb', line 7058 def format(q) q.text(value) end |