Class: SyntaxTree::JSON::RootNode

Inherits:
Struct
  • Object
show all
Defined in:
lib/syntax_tree/json.rb

Overview

This is always the root of the syntax tree.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#objectObject

Returns the value of attribute object

Returns:

  • (Object)

    the current value of object



11
12
13
# File 'lib/syntax_tree/json.rb', line 11

def object
  @object
end

Instance Method Details

#format(q) ⇒ Object



12
13
14
15
# File 'lib/syntax_tree/json.rb', line 12

def format(q)
  object.format(q)
  q.breakable(force: true)
end

#pretty_print(q) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/syntax_tree/json.rb', line 17

def pretty_print(q)
  q.group(2, "(root", ")") do
    q.breakable
    q.text("object=")
    q.pp(object)
  end
end