Sha256: 0544fc4e2153a0938ad41f6a73dd843bd5fc4c7b52e0f9db657059767dec74dd

Contents?: true

Size: 244 Bytes

Versions: 8

Compression:

Stored size: 244 Bytes

Contents

module Spruz
  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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spruz-0.2.13 lib/spruz/hash_union.rb
spruz-0.2.12 lib/spruz/hash_union.rb
spruz-0.2.11 lib/spruz/hash_union.rb
spruz-0.2.10 lib/spruz/hash_union.rb
spruz-0.2.9 lib/spruz/hash_union.rb
spruz-0.2.8 lib/spruz/hash_union.rb
spruz-0.2.7 lib/spruz/hash_union.rb
spruz-0.2.6 lib/spruz/hash_union.rb