diff options
author | Max Lincoln <max@devopsy.com> | 2014-12-23 15:06:40 -0500 |
---|---|---|
committer | dblock <dblock@dblock.org> | 2014-12-30 16:01:47 -0500 |
commit | 0e40e63ebc0bdec0af98de2b54fddb5199f19515 (patch) | |
tree | 0dd3b133f38e2b4055506c0540daec2bafb9bb54 /README.md | |
parent | 12f031b013cae5463a4fe42f416fef75edfcdf94 (diff) | |
download | hashie-0e40e63ebc0bdec0af98de2b54fddb5199f19515.tar.gz |
Public utility methods for stringify/symbolize keys
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -141,6 +141,19 @@ end The KeyConversion extension gives you the convenience methods of `symbolize_keys` and `stringify_keys` along with their bang counterparts. You can also include just stringify or just symbolize with `Hashie::Extensions::StringifyKeys` or `Hashie::Extensions::SymbolizeKeys`. +Hashie also has a utility method for converting keys on a Hash within including a mixin: + +```ruby +Hashie.symbolize_keys! hash +# => Symbolizes keys of hash. +Hashie.symbolize_keys hash +# => Returns a copy of hash with keys symbolized. +Hashie.stringify_keys hash +# => Stringifies keys of hash. +Hashie.stringify_keys hash +# => Returns a copy of hash with keys stringified. +``` + ### MergeInitializer The MergeInitializer extension simply makes it possible to initialize a Hash subclass with another Hash, giving you a quick short-hand. |