Module: Aurb::CoreExt::Hash
- Defined in:
- lib/aurb/core_ext/hash.rb
Instance Method Summary collapse
-
#method_missing(key) ⇒ Object
Delegation.
-
#symbolize_keys ⇒ Object
Returns a new hash with all keys converted to symbols.
-
#symbolize_keys! ⇒ Object
Destructively converts all keys to symbols.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key) ⇒ Object
Delegation
21 22 23 |
# File 'lib/aurb/core_ext/hash.rb', line 21 def method_missing(key) symbolize_keys[key.to_sym] end |
Instance Method Details
#symbolize_keys ⇒ Object
Returns a new hash with all keys converted to symbols.
8 9 10 11 12 13 |
# File 'lib/aurb/core_ext/hash.rb', line 8 def symbolize_keys inject({}) do |, (key, value)| [(key.to_sym rescue key) || key] = value end end |
#symbolize_keys! ⇒ Object
Destructively converts all keys to symbols.
16 17 18 |
# File 'lib/aurb/core_ext/hash.rb', line 16 def symbolize_keys! replace symbolize_keys end |