HardBoiled
simply define mapping from you model to a simple hash. For those who worked with thoughtbot's factory girl the DSL should be familiar.
Installation
gem install hard-boiled
Usage
require 'hard-boiled'
egg = OpenStruct.new({
:boil_time => 7,
:temperature => 99,
:colour => "beige"
})
HardBoiled::Presenter.define egg do
time :from => :boil_time
colour
temperature :format => "%d ℃"
end # => { :time => 7, :temperature => "99 ℃", :colour => "beige" }
for more examples see the tests in the spec
directory.
Similar Projects
If hard-boiled isn't your cup of tea, go and check out other ways to map models to hashes (for data serialization):