Class: Hash
- Extended by:
- Forwardable
- Defined in:
- lib/core-extensions/hash_ext.rb,
lib/core-extensions/hash_ext.rb
Instance Method Summary collapse
Instance Method Details
#calculate_stable_hashable ⇒ Object
21 22 23 |
# File 'lib/core-extensions/hash_ext.rb', line 21 def calculate_stable_hashable map { |k,v| "#{k.inspect}:#{v.inspect}" }.sort.join("//") end |
#stringify_keys ⇒ Object
4 5 6 7 8 |
# File 'lib/core-extensions/hash_ext.rb', line 4 def stringify_keys r = [] each { |k,v| r << k.to_s << v } Hash[*r] end |
#symbolize_keys ⇒ Object
10 11 12 13 14 |
# File 'lib/core-extensions/hash_ext.rb', line 10 def symbolize_keys r = [] each { |k,v| r << (k.respond_to?(:to_sym) ? k.to_sym : k) << v } Hash[*r] end |