Skip to content

v0.6.2

Choose a tag to compare

@amancevice amancevice released this 06 Jul 13:00
· 84 commits to main since this release
3624bbb

Added support methods to Hash:

  • Hash#deep_keys returns all nested keys in a Hash
  • Hash#deep_transform_keys transforms all nested keys in a Hash
  • Hash#deep_transform_keys! transforms all nested keys in a Hash in place
  • Hash#stringify_names! stringifies names in place
  • Hash#symbolize_names! symbolizes names in place

Hash#symbolize_names and Hash#stringify_names now use Hash#deep_transform_keys

{ a: { b: 'c', d: 'e' }, f: 'g' }.deep_keys
# => [:a, :b, :d, :f]

{ a: { b: 'c', d: 'e' }, f: 'g' }.deep_transform_keys(&:to_s)
# => { "a" => { "b" => "c", "d" => "e" }, "f" => "g" }

hash = { a: { b: 'c', d: 'e' }, f: 'g' }
hash.deep_transform_keys!(&:to_s)
# => { "a" => { "b" => "c", "d" => "e" }, "f" => "g" }