Class: Castle::Utils::Merge
- Inherits:
-
Object
- Object
- Castle::Utils::Merge
- Defined in:
- lib/castle/utils/merge.rb
Class Method Summary collapse
Class Method Details
.call(base, extra) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/castle/utils/merge.rb', line 6 def self.call(base, extra) base_s = Castle::Utils::DeepSymbolizeKeys.call(base) extra_s = Castle::Utils::DeepSymbolizeKeys.call(extra) extra_s.each do |name, value| if value.nil? base_s.delete(name) elsif value.is_a?(Hash) && base_s[name].is_a?(Hash) base_s[name] = call(base_s[name], value) else base_s[name] = value end end base_s end |