DotHash
A very efficient gem that lets you use hashes as object properties. It is almost as fast as a plain Hash
since it's complexity is also linear, O(n) # where N is the number of nested parents of the given property.
Installation
Add this line to your application's Gemfile:
gem 'dot_hash'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dot_hash
Usage
some_hash = {size: {height: 100, width: 500}, "color" => "red"}
properties = some_hash.to_properties
properties.size.height # returns 100, it is the same as some_hash[:size][:height]
properties.color # returns "red", it works with Strings and Symbol keys
properties[:color] # returns "red", can be used like a hash with string keys
properties["color"] # returns "red", can be used like a hash with symbol keys
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Added some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request

