Class: Hash
Overview
Make testing for multiple keys easiers on a hash
Instance Method Summary collapse
Instance Method Details
#has_all_keys?(*keys) ⇒ Boolean
5 6 7 |
# File 'lib/deployable/patch/hash_keys.rb', line 5 def has_all_keys? *keys keys.all? do |key| has_key?(key) end end |
#has_any_keys?(*keys) ⇒ Boolean
9 10 11 |
# File 'lib/deployable/patch/hash_keys.rb', line 9 def has_any_keys? *keys keys.any? do |key| has_key?(key) end end |