Sha256: 7103d29cd6066474d3795d337551fc82f18ad2c9c9d65ea17eac76ab9c18dcb5

Contents?: true

Size: 346 Bytes

Versions: 3

Compression:

Stored size: 346 Bytes

Contents

class Hash
  # Returns true or false whether the hash
  # contains the given keys.
  #
  #   require 'facet/hash/has_keys?'
  #
  #   h = { :a => 1, :b => 2 }
  #   h.has_keys?( :a )   #=> true
  #   h.has_keys?( :c )   #=> false
  #
  def has_keys?(*check_keys)
    unknown_keys = check_keys - self.keys
    return unknown_keys.empty?
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-0.7.1 lib/facet/hash/has_keys%3F.rb
facets-0.7.0 lib/facet/hash/has_keys%3F.rb
facets-0.7.2 lib/facet/hash/has_keys%3F.rb