Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/tray/checkout/hash.rb
Instance Method Summary collapse
Instance Method Details
#symbolize_all_keys ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/tray/checkout/hash.rb', line 3 def symbolize_all_keys {}.tap do |results| self.each do |key, value| if value.is_a?(Array) symbolized_value = value.map { |item| item.is_a?(Hash) ? item.symbolize_all_keys : item } else symbolized_value = value.is_a?(Hash) ? value.symbolize_all_keys : value end results[(key.to_sym rescue key)] = symbolized_value end end end |