Class: Jsonerino::JsonObject
- Defined in:
- lib/jsonerino/ast.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from JsonValue
Instance Method Summary collapse
-
#initialize ⇒ JsonObject
constructor
A new instance of JsonObject.
- #push(key, value) ⇒ Object
- #resolve ⇒ Object
Constructor Details
#initialize ⇒ JsonObject
Returns a new instance of JsonObject.
69 70 71 |
# File 'lib/jsonerino/ast.rb', line 69 def initialize() @value = {} end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
67 68 69 |
# File 'lib/jsonerino/ast.rb', line 67 def value @value end |
Instance Method Details
#push(key, value) ⇒ Object
73 74 75 76 77 |
# File 'lib/jsonerino/ast.rb', line 73 def push(key, value) raise 'Value is not instnace of JsonValue' unless value.is_a? JsonValue @value[key] = value end |
#resolve ⇒ Object
79 80 81 82 83 84 |
# File 'lib/jsonerino/ast.rb', line 79 def resolve @value.keys.each do |key| @value[key] = @value[key].resolve end @value end |