Sha256: c9f0691500aa773d762080748ec545159ccd19417fc1b1f5428f5aec6b6db595

Contents?: true

Size: 326 Bytes

Versions: 2

Compression:

Stored size: 326 Bytes

Contents

module Koalemos
  module HashUnion
    def |(other)
      other = other.to_hash if other.respond_to?(:to_hash)
      other.merge(self)
    end
  end
  
  class ::Hash
    if method_defined?(:|)
      warn "#{self}#| already defined, didn't include at #{__FILE__}:#{__LINE__}"
    else
      include HashUnion
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
koalemos-0.0.2 lib/koalemos/hash_union.rb
koalemos-0.0.1 lib/koalemos/hash_union.rb