Class: SyntaxTree::JSON::ArrayNode

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

Overview

This contains an array node. The values argument to the struct is an array.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valuesObject

Returns the value of attribute values

Returns:

  • (Object)

    the current value of values



59
60
61
# File 'lib/syntax_tree/json.rb', line 59

def values
  @values
end

Instance Method Details

#format(q) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/syntax_tree/json.rb', line 60

def format(q)
  q.group do
    q.text("[")

    q.indent do
      q.breakable("")
      q.seplist(values) { |value| value.format(q) }
    end

    q.breakable("")
    q.text("]")
  end
end

#pretty_print(q) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/syntax_tree/json.rb', line 74

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