Class: Declarative::Defaults::Merge
- Inherits:
-
Object
- Object
- Declarative::Defaults::Merge
- Defined in:
- lib/declarative/defaults.rb
Overview
Private! Don’t use this anywhere. Merges two hashes and joins same-named arrays. This is often needed when dealing with defaults.
Class Method Summary collapse
Class Method Details
.call(a, b) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/declarative/defaults.rb', line 32 def self.call(a, b) a = a.dup b.each do |k, v| a[k] = v and next unless a.has_key?(k) a[k] = v and next unless a[k].is_a?(Array) a[k] = a[k] += v # only for arrays. end a end |