Class: Dentaku::AST::Literal
Constant Summary
Constants inherited from Node
Node::STATIC_CONTEXT, Node::STATIC_MODE_KEY
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #dependencies ⇒ Object
-
#initialize(token) ⇒ Literal
constructor
A new instance of Literal.
- #quoted ⇒ Object (also: #to_s)
- #value ⇒ Object
Methods inherited from Node
arity, #name, precedence, #pure?, resolve_class
Constructor Details
#initialize(token) ⇒ Literal
Returns a new instance of Literal.
6 7 8 9 10 |
# File 'lib/dentaku/ast/literal.rb', line 6 def initialize(token) @token = token @value = token.value @type = token.category end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/dentaku/ast/literal.rb', line 4 def type @type end |
Instance Method Details
#accept(visitor) ⇒ Object
20 21 22 |
# File 'lib/dentaku/ast/literal.rb', line 20 def accept(visitor) visitor.visit_literal(self) end |
#dependencies ⇒ Object
16 17 18 |
# File 'lib/dentaku/ast/literal.rb', line 16 def dependencies(*) [] end |
#quoted ⇒ Object Also known as: to_s
24 25 26 |
# File 'lib/dentaku/ast/literal.rb', line 24 def quoted @token.raw_value || value.to_s end |
#value ⇒ Object
12 13 14 |
# File 'lib/dentaku/ast/literal.rb', line 12 def value(*) @value end |