apotonick/representable — pull request #30 by tylerkahn (2013-01-17 16:49:10+00:00)
Title: Give option to set the name of a property

Sometimes it may be useful to have the ability to set the name (the name of the attribute of the object you are representing) in the options passed into a Definition.

class Article
include Representable::JSON
attr_accessor :title
property :heading, :name => :title # implicit :from => :heading
end

a = Article.new; a.title = "Godzilla!"
a.to_json # => '{"heading" : "Godzilla!"}'