Class: JSON::Stream::ObjectNode
- Inherits:
-
Object
- Object
- JSON::Stream::ObjectNode
- Defined in:
- lib/json/stream/builder.rb
Instance Attribute Summary collapse
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
Instance Method Summary collapse
- #<<(node) ⇒ Object
-
#initialize ⇒ ObjectNode
constructor
A new instance of ObjectNode.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ ObjectNode
Returns a new instance of ObjectNode.
80 81 82 |
# File 'lib/json/stream/builder.rb', line 80 def initialize @obj, @key = {}, nil end |
Instance Attribute Details
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
78 79 80 |
# File 'lib/json/stream/builder.rb', line 78 def obj @obj end |
Instance Method Details
#<<(node) ⇒ Object
84 85 86 87 88 89 90 91 92 |
# File 'lib/json/stream/builder.rb', line 84 def <<(node) if @key @obj[@key] = node @key = nil else @key = node end self end |
#to_s ⇒ Object
94 95 96 |
# File 'lib/json/stream/builder.rb', line 94 def to_s "OBJ Node: {#{@key.inspect}: #{@obj.inspect}}" end |