Sha256: 534fecb9cea67bf6e6b82d884c7ce03a5be40694e6ea315c6aded6c4787d1896

Contents?: true

Size: 337 Bytes

Versions: 12

Compression:

Stored size: 337 Bytes

Contents

module Hash::EnsureKeys
  def keys?(*keys)
    (keys - self.keys()).empty?
  end
end

class Hash
  include EnsureKeys
end

module Hash::EnsureKeys::Etest
  def test_ensure_keys
    h = { :a => "a" }
    assert_equal true, h.keys?(:a)
    assert_equal true, h.keys?
    assert_equal false, h.keys?(:a, :b)
  end
end if VEX_TEST == "base"

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vex-0.6.2 lib/vex/base/hash/ensure_keys.rb
vex-0.4.4 lib/vex/base/hash/ensure_keys.rb
vex-0.4.2 lib/vex/base/hash/ensure_keys.rb
vex-0.3.3 lib/vex/base/hash/ensure_keys.rb
vex-0.2.9 lib/vex/base/hash/ensure_keys.rb
vex-0.2.8 lib/vex/base/hash/ensure_keys.rb
vex-0.2.7 lib/vex/base/hash/ensure_keys.rb
vex-0.2.6 lib/vex/base/hash/ensure_keys.rb
vex-0.2.5 lib/vex/base/hash/ensure_keys.rb
vex-0.2.2 lib/vex/base/hash/ensure_keys.rb
vex-0.2.1 lib/vex/base/hash/ensure_keys.rb
vex-0.2 lib/vex/base/hash/ensure_keys.rb