Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/arisaid/core_ext/hash.rb
Instance Method Summary collapse
Instance Method Details
#slice(*keys) ⇒ Object
2 3 4 |
# File 'lib/arisaid/core_ext/hash.rb', line 2 def slice(*keys) keys.each_with_object(self.class.new) { |k, hash| hash[k] = self[k] if has_key?(k) } end |
#stringify_keys ⇒ Object
6 7 8 9 10 |
# File 'lib/arisaid/core_ext/hash.rb', line 6 def stringify_keys result = self.class.new each_key { |k| result[k.to_s] = self[k] } result end |