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-1.38.0 lib/tins/hash_union.rb
tins-1.37.1 lib/tins/hash_union.rb
tins-1.37.0 lib/tins/hash_union.rb
tins-1.36.1 lib/tins/hash_union.rb
tins-1.36.0 lib/tins/hash_union.rb
tins-1.35.0 lib/tins/hash_union.rb
tins-1.34.0 lib/tins/hash_union.rb
tins-1.33.0 lib/tins/hash_union.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/lib/tins/hash_union.rb
tins-1.32.1 lib/tins/hash_union.rb
tins-1.32.0 lib/tins/hash_union.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/lib/tins/hash_union.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/lib/tins/hash_union.rb
tins-1.31.1 lib/tins/hash_union.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/tins-1.31.0/lib/tins/hash_union.rb
tins-1.31.0 lib/tins/hash_union.rb
tins-1.30.0 lib/tins/hash_union.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/lib/tins/hash_union.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/lib/tins/hash_union.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/lib/tins/hash_union.rb