Class: Jsonerino::JsonObject

Inherits:
JsonValue show all
Defined in:
lib/jsonerino/ast.rb

Instance Attribute Summary collapse

Attributes inherited from JsonValue

#finish, #start

Instance Method Summary collapse

Constructor Details

#initializeJsonObject

Returns a new instance of JsonObject.



69
70
71
# File 'lib/jsonerino/ast.rb', line 69

def initialize()
  @value = {}
end

Instance Attribute Details

#valueObject (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

#resolveObject



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