Sha256: 8a44c67d283161856bd65d804c93a58a75dadcb822a7d42e11f772f58e6a7e92

Contents?: true

Size: 564 Bytes

Versions: 8

Compression:

Stored size: 564 Bytes

Contents

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

    other_keys = other.keys
    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

8 entries across 8 versions & 1 rubygems

Version Path
rr-1.1.2 lib/rr/core_ext/hash.rb
rr-1.1.2.rc1 lib/rr/core_ext/hash.rb
rr-1.1.1 lib/rr/core_ext/hash.rb
rr-1.1.1.rc1 lib/rr/core_ext/hash.rb
rr-1.1.0 lib/rr/core_ext/hash.rb
rr-1.1.0.rc3 lib/rr/core_ext/hash.rb
rr-1.1.0.rc2 lib/rr/core_ext/hash.rb
rr-1.1.0.rc1 lib/rr/core_ext/hash.rb