Class: SyntaxTree::JSON::AST::Root
- Defined in:
- lib/syntax_tree/json/ast.rb
Overview
This is the top of the JSON syntax tree.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(value:) ⇒ Root
constructor
A new instance of Root.
Methods inherited from Node
Constructor Details
#initialize(value:) ⇒ Root
Returns a new instance of Root.
124 125 126 |
# File 'lib/syntax_tree/json/ast.rb', line 124 def initialize(value:) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
122 123 124 |
# File 'lib/syntax_tree/json/ast.rb', line 122 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
128 129 130 |
# File 'lib/syntax_tree/json/ast.rb', line 128 def accept(visitor) visitor.visit_root(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
132 133 134 |
# File 'lib/syntax_tree/json/ast.rb', line 132 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
138 139 140 |
# File 'lib/syntax_tree/json/ast.rb', line 138 def deconstruct_keys(keys) { value: value } end |