Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/fusuma/hash_support.rb
Overview
Patch to hash
Instance Method Summary collapse
-
#deep_symbolize_keys ⇒ Object
activesupport-4.1.1/lib/active_support/core_ext/hash/keys.rb.
- #deep_transform_keys(&block) ⇒ Object
-
#deep_transform_values(&block) ⇒ Object
activesupport/lib/active_support/core_ext/hash/deep_transform_values.rb.
Instance Method Details
#deep_symbolize_keys ⇒ Object
activesupport-4.1.1/lib/active_support/core_ext/hash/keys.rb
6 7 8 9 10 11 12 |
# File 'lib/fusuma/hash_support.rb', line 6 def deep_symbolize_keys deep_transform_keys do |key| key.to_sym rescue StandardError key end end |
#deep_transform_keys(&block) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/fusuma/hash_support.rb', line 14 def deep_transform_keys(&block) result = {} each do |key, value| result[yield(key)] = value.is_a?(Hash) ? value.deep_transform_keys(&block) : value end result end |
#deep_transform_values(&block) ⇒ Object
activesupport/lib/active_support/core_ext/hash/deep_transform_values.rb
23 24 25 |
# File 'lib/fusuma/hash_support.rb', line 23 def deep_transform_values(&block) _deep_transform_values_in_object(self, &block) end |