Shazo is a hash mapping tool.
Mapping is translated into Japanese as shazo.
Add this line to your application's Gemfile:
gem 'shazo'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install shazo
class MappedHash < Hash
include Shazo
property :id, -> { origin[:user_id] }
property :name, -> { origin[:namae] }
end
before = { user_id: 1, namae: "ogontaro" }
after = MappedHash.new(before) #-> { id: 1, name: "ogontaro" }
Bug reports and pull requests are welcome on GitHub at https://github.com/ogontaro/shazo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Shazo project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.