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
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:, comments: []) ⇒ RationalLiteral
Returns a new instance of RationalLiteral.
7130 7131 7132 7133 7134 |
# File 'lib/syntax_tree/node.rb', line 7130 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
7128 7129 7130 |
# File 'lib/syntax_tree/node.rb', line 7128 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the rational number literal
7125 7126 7127 |
# File 'lib/syntax_tree/node.rb', line 7125 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
7136 7137 7138 |
# File 'lib/syntax_tree/node.rb', line 7136 def accept(visitor) visitor.visit_rational(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7140 7141 7142 |
# File 'lib/syntax_tree/node.rb', line 7140 def child_nodes [] end |
#deconstruct_keys(_keys) ⇒ Object
7146 7147 7148 |
# File 'lib/syntax_tree/node.rb', line 7146 def deconstruct_keys(_keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
7150 7151 7152 |
# File 'lib/syntax_tree/node.rb', line 7150 def format(q) q.text(value) end |