lib/jsonify/json_value.rb in jsonify-0.0.3 vs lib/jsonify/json_value.rb in jsonify-0.0.4
- old
+ new
@@ -28,11 +28,17 @@
def values
@values.values
end
def add(key, val=nil)
- pair = (JsonPair === key) ? key : JsonPair.new(key, val)
+ pair = ( JsonPair === key ? key : JsonPair.new(key, val) )
@values.store(pair.key, pair)
+ end
+
+ def merge(json_object)
+ json_object.values.each do |pair|
+ @values.store(pair.key, pair)
+ end
end
alias_method :<<, :add
alias_method :add!, :add # for consistency with the Builder api
\ No newline at end of file