document_hash 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/document_hash/core.rb +3 -3
- data/lib/document_hash/version.rb +1 -1
- metadata +1 -1
data/lib/document_hash/core.rb
CHANGED
@@ -43,13 +43,14 @@ module DocumentHash
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def merge other
|
46
|
-
|
47
|
-
super other
|
46
|
+
dup.merge! other
|
48
47
|
end
|
49
48
|
|
50
49
|
def merge! other
|
51
50
|
self.class.symbolize_keys other
|
51
|
+
other = Hash[ other.collect{ |k, v| [ k, execute_before_change_callback(k,v) ] } ]
|
52
52
|
super other
|
53
|
+
other.each { |k, v| changed_key k,v }
|
53
54
|
end
|
54
55
|
|
55
56
|
private
|
@@ -69,7 +70,6 @@ module DocumentHash
|
|
69
70
|
|
70
71
|
value = @before_change.call path, value if @before_change
|
71
72
|
value = parent.__send__ :execute_before_change_callback, path.unshift(parent_key), value if parent
|
72
|
-
|
73
73
|
value
|
74
74
|
end
|
75
75
|
|