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.
86 87 88 |
# File 'lib/json/stream/builder.rb', line 86 def initialize @obj, @key = {}, nil end |
Instance Attribute Details
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
84 85 86 |
# File 'lib/json/stream/builder.rb', line 84 def obj @obj end |
Instance Method Details
#<<(node) ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'lib/json/stream/builder.rb', line 90 def <<(node) if @key @obj[@key] = node @key = nil else @key = node end self end |
#to_s ⇒ Object
100 101 102 |
# File 'lib/json/stream/builder.rb', line 100 def to_s "OBJ Node: {#{@key.inspect}: #{@obj.inspect}}" end |