Class: SyntaxTree::JSON::ArrayNode
- Inherits:
-
Struct
- Object
- Struct
- SyntaxTree::JSON::ArrayNode
- 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
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
Instance Attribute Details
#values ⇒ Object
Returns the value of attribute 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 |