File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ def facts
98
98
99
99
def add_facts ( new_facts = { } )
100
100
validate_fact_names ( new_facts )
101
- @facts = Bolt ::Util . deep_merge ( @facts , new_facts )
101
+ Bolt ::Util . deep_merge! ( @facts , new_facts )
102
102
end
103
103
104
104
def features
Original file line number Diff line number Diff line change @@ -212,6 +212,17 @@ def deep_merge(hash1, hash2)
212
212
hash1 . merge ( hash2 , &recursive_merge )
213
213
end
214
214
215
+ def deep_merge! ( hash1 , hash2 )
216
+ recursive_merge = proc do |_key , h1 , h2 |
217
+ if h1 . is_a? ( Hash ) && h2 . is_a? ( Hash )
218
+ h1 . merge! ( h2 , &recursive_merge )
219
+ else
220
+ h2
221
+ end
222
+ end
223
+ hash1 . merge! ( hash2 , &recursive_merge )
224
+ end
225
+
215
226
# Accepts a Data object and returns a copy with all hash keys
216
227
# modified by block. use &:to_s to stringify keys or &:to_sym to symbolize them
217
228
def walk_keys ( data , &block )
You can’t perform that action at this time.
0 commit comments