Class: SyntaxTree::JSON::LiteralNode
- Inherits:
-
Struct
- Object
- Struct
- SyntaxTree::JSON::LiteralNode
- Defined in:
- lib/syntax_tree/json.rb
Overview
This contains a literal node. The value argument to the struct is a literal value like a string, number, or boolean.
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value
85 86 87 |
# File 'lib/syntax_tree/json.rb', line 85 def value @value end |
Instance Method Details
#format(q) ⇒ Object
86 87 88 |
# File 'lib/syntax_tree/json.rb', line 86 def format(q) q.text(value.to_json) end |
#pretty_print(q) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/syntax_tree/json.rb', line 90 def pretty_print(q) q.group(2, "(literal", ")") do q.breakable q.text("value=") q.text(value.inspect) end end |