Module: HashIntersectArrays
- Defined in:
- lib/hash_union_arrays.rb
Class Method Summary collapse
-
.ordered_union(a, b) ⇒ Object
acts just like Hash#merge, except that any arrays.
Class Method Details
.ordered_union(a, b) ⇒ Object
acts just like Hash#merge, except that any arrays
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/hash_union_arrays.rb', line 4 def self.ordered_union(a, b) for k in b.keys if b[k].is_a?(Array) and a[k] and a[k].is_a?(Array) a[k] |= b[k] else a[k] = b[k] end end return a end |