Sha256: 13d98ead8f9ea8234c09b4ba4fb5bac37dc2e835b233baec74fddcb9aeb6b465
Contents?: true
Size: 388 Bytes
Versions: 3
Compression:
Stored size: 388 Bytes
Contents
class Hash # Returns true or false whether the hash contains # _only_ the given keys. # # require 'facet/hash/has_only_keys?' # # h = { :a => 1, :b => 2 } # h.has_only_keys?( :a, :b ) #=> true # h.has_only_keys?( :a ) #=> false # def has_only_keys?(*check_keys) unknown_keys = self.keys - check_keys return !unknown_keys.empty? end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-0.7.0 | lib/facet/hash/has_only_keys%3F.rb |
facets-0.7.1 | lib/facet/hash/has_only_keys%3F.rb |
facets-0.7.2 | lib/facet/hash/has_only_keys%3F.rb |