Skip to content

Instantly share code, notes, and snippets.

@guiocavalcanti
Created June 19, 2015 20:51
Show Gist options
  • Save guiocavalcanti/f0cc491b93b92a19de9b to your computer and use it in GitHub Desktop.
Save guiocavalcanti/f0cc491b93b92a19de9b to your computer and use it in GitHub Desktop.
class Representer < Representable::Decorator
include Representable::JSON
property :name, reader: lambda { |doc, args|
doc["full_name"] = doc["name"] + doc["surname"]
self.name = doc["name"]
}
property :surname
property :full_name
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment