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.
Constructor Details
#initialize ⇒ ObjectNode
Returns a new instance of ObjectNode.
76 77 78 |
# File 'lib/json/stream/builder.rb', line 76 def initialize @obj, @key = {}, nil end |
Instance Attribute Details
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
74 75 76 |
# File 'lib/json/stream/builder.rb', line 74 def obj @obj end |
Instance Method Details
#<<(node) ⇒ Object
80 81 82 83 84 85 86 87 88 |
# File 'lib/json/stream/builder.rb', line 80 def <<(node) if @key @obj[@key] = node @key = nil else @key = node end self end |