Sha256: 167d1b8f43702af73910116741498d741a8e9d8d2498edd76b3475e977e40a40

Contents?: true

Size: 265 Bytes

Versions: 176

Compression:

Stored size: 265 Bytes

Contents

module Tins
  module HashUnion
    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
  end
end

require 'tins/alias'

Version data entries

176 entries across 158 versions & 9 rubygems

Version Path
tins-0.4.0 lib/tins/hash_union.rb
tins-0.3.14 lib/tins/hash_union.rb
tins-0.3.13 lib/tins/hash_union.rb
tins-0.3.12 lib/tins/hash_union.rb
tins-0.3.11 lib/tins/hash_union.rb
tins-0.3.10 lib/tins/hash_union.rb
tins-0.3.9 lib/tins/hash_union.rb
tins-0.3.8 lib/tins/hash_union.rb
tins-0.3.7 lib/tins/hash_union.rb
tins-0.3.6 lib/tins/hash_union.rb
tins-0.3.5 lib/tins/hash_union.rb
tins-0.3.4 lib/tins/hash_union.rb
tins-0.3.3 lib/tins/hash_union.rb
tins-0.3.2 lib/tins/hash_union.rb
tins-0.3.1 lib/tins/hash_union.rb
tins-0.3.0 lib/tins/hash_union.rb