Method: Hash#keys?
- Defined in:
- lib/core/facets/hash/keys.rb
#keys?(*check_keys) ⇒ Boolean Also known as: has_keys?
Returns true or false whether the hash contains the given keys.
h = { :a => 1, :b => 2 }
h.has_keys?( :a ) #=> true
h.has_keys?( :c ) #=> false
CREDIT: Trans
12 13 14 15 |
# File 'lib/core/facets/hash/keys.rb', line 12 def keys?(*check_keys) unknown_keys = check_keys - self.keys return unknown_keys.empty? end |