Sha256: 0de420a805d23792f949ae8f7824d2d059b31a84d0cd3dfc149121492fb3b2c4

Contents?: true

Size: 614 Bytes

Versions: 12

Compression:

Stored size: 614 Bytes

Contents

class Hash
  def wildcard_match?(other)
    return false unless other.is_a?(Hash)

    other_keys = other.keys
    return false if keys.size != other_keys.size

    other_values = other.values
    each_with_index do |(key, value), i|
      if key.respond_to?(:wildcard_match?)
        return false unless key.wildcard_match?(other_keys[i])
      else
        return false unless key == other_keys[i]
      end
      if value.respond_to?(:wildcard_match?)
        return false unless value.wildcard_match?(other_values[i])
      else
        return false unless value == other_values[i]
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rr-3.0.9 lib/rr/core_ext/hash.rb
rr-3.0.8 lib/rr/core_ext/hash.rb
rr-3.0.7 lib/rr/core_ext/hash.rb
rr-3.0.6 lib/rr/core_ext/hash.rb
rr-3.0.5 lib/rr/core_ext/hash.rb
rr-3.0.4 lib/rr/core_ext/hash.rb
rr-3.0.3 lib/rr/core_ext/hash.rb
rr-3.0.2 lib/rr/core_ext/hash.rb
rr-3.0.1 lib/rr/core_ext/hash.rb
rr-3.0.0 lib/rr/core_ext/hash.rb
rr-1.2.1 lib/rr/core_ext/hash.rb
rr-1.2.0 lib/rr/core_ext/hash.rb