Module: HashKeys
- Defined in:
- lib/hash-keys.rb,
lib/hash-keys/version.rb
Constant Summary collapse
- VERSION =
"1.0.1"
Instance Method Summary collapse
Instance Method Details
#extract(*keys) ⇒ Object
6 7 8 |
# File 'lib/hash-keys.rb', line 6 def extract *keys select { |k, v| keys.include? k } end |
#has_keys?(*keys) ⇒ Boolean
2 3 4 |
# File 'lib/hash-keys.rb', line 2 def has_keys?(*keys) !keys.any? { |key| !self.has_key? key } end |