Class: Hash
- Defined in:
- lib/perennial/core_ext/blank.rb,
lib/perennial/nash.rb,
lib/perennial/core_ext/hash_key_conversions.rb
Overview
:nodoc:
Instance Method Summary collapse
- #stringify_keys ⇒ Object
- #stringify_keys! ⇒ Object
- #symbolize_keys ⇒ Object
- #symbolize_keys! ⇒ Object
- #to_nash ⇒ Object
Instance Method Details
#stringify_keys ⇒ Object
20 21 22 23 24 |
# File 'lib/perennial/core_ext/hash_key_conversions.rb', line 20 def stringify_keys hash = self.dup hash.stringify_keys! return hash end |
#stringify_keys! ⇒ Object
14 15 16 17 18 |
# File 'lib/perennial/core_ext/hash_key_conversions.rb', line 14 def stringify_keys! hash = {} self.each_pair { |k, v| hash[k.to_s] = v } replace hash end |
#symbolize_keys ⇒ Object
2 3 4 5 6 |
# File 'lib/perennial/core_ext/hash_key_conversions.rb', line 2 def symbolize_keys hash = self.dup hash.symbolize_keys! return hash end |
#symbolize_keys! ⇒ Object
8 9 10 11 12 |
# File 'lib/perennial/core_ext/hash_key_conversions.rb', line 8 def symbolize_keys! hash = {} self.each_pair { |k,v| hash[k.to_sym] = v } replace hash end |
#to_nash ⇒ Object
214 215 216 |
# File 'lib/perennial/nash.rb', line 214 def to_nash Perennial::Nash.new(self) end |