CoolHash
Cool Hash is a collection of cool hash extensions in ruby that extend the default hash class.
Installation
Add this line to your application's Gemfile:
gem 'cool_hash'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cool_hash
Usage
Its probably easier to just install whatever hash function by gem but just in case you wish to use this gem:
require 'cool_hash'
To use the individual gems:
- Camelize your snake keys when working with JSON APIs: https://github.com/futurechimp/awrence ```Ruby my_hash = => 1, "foo_bars" => [{"baz_baz" => "value", => "value"]} camel_hash = my_hash.to_camel_keys # => => 1, "FooBars" => [{"BazBaz" => "value", => "value"]}
OR
camel_hash = my_hash.to_camelback_keys
=> => 1, "fooBars" => [{"bazBaz" => "value", => "value"]}
2. Snakify your camel keys when working with JSON APIs: https://github.com/futurechimp/plissken
```Ruby
my_hash = {"firstKey" => 1, "fooBars" => [{"bazBaz" => "value"}, {"blahBlah" => "value"}]}
snaked_hash = my_hash.to_snake_keys
# => {"first_key" => 1, "foo_bars" => [{"baz_baz" => "value"}, {"blah_blah" => "value"}]}
- Facets Hashery Collection of Hash-based classes: https://github.com/rubyworks/hashery
Ruby # Please read the documentation.
- Hashie is a collection of classes and mixins that make hashes more powerful: https://github.com/intridea/hashie
Ruby # Please read the documentation.
## Other Related Gems: - https://github.com/zilkey/active_hash
- https://github.com/idlefingers/hash-pipe
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
- Fork it ( https://github.com/[my-github-username]/cool_hash/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
All licenses belong to their respective gems. This is merely a collection.