Class: Hash
- Defined in:
- lib/perennial/core_ext/blank.rb,
lib/perennial/core_ext/misc.rb
Overview
:nodoc:
Instance Method Summary collapse
- #stringify_keys ⇒ Object
- #stringify_keys! ⇒ Object
- #symbolize_keys ⇒ Object
- #symbolize_keys! ⇒ Object
Instance Method Details
#stringify_keys ⇒ Object
94 95 96 97 98 |
# File 'lib/perennial/core_ext/misc.rb', line 94 def stringify_keys hash = self.dup hash.stringify_keys! return hash end |
#stringify_keys! ⇒ Object
88 89 90 91 92 |
# File 'lib/perennial/core_ext/misc.rb', line 88 def stringify_keys! hash = {} self.each_pair { |k, v| hash[k.to_s] = v } replace hash end |
#symbolize_keys ⇒ Object
76 77 78 79 80 |
# File 'lib/perennial/core_ext/misc.rb', line 76 def symbolize_keys hash = self.dup hash.symbolize_keys! return hash end |
#symbolize_keys! ⇒ Object
82 83 84 85 86 |
# File 'lib/perennial/core_ext/misc.rb', line 82 def symbolize_keys! hash = {} self.each_pair { |k,v| hash[k.to_sym] = v } replace hash end |