Module: Tins::HashUnion

Defined in:
lib/tins/hash_union.rb

Instance Method Summary collapse

Instance Method Details

#|(other) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/tins/hash_union.rb', line 3

def |(other)
  case
  when other.respond_to?(:to_hash)
    other = other.to_hash
  when other.respond_to?(:to_h)
    other = other.to_h
  end
  other.merge(self)
end