Module: Roar::Sinatra

Defined in:
lib/roar-sinatra.rb,
lib/roar-sinatra/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#roar(object, options = {}) ⇒ Object



8
9
10
11
12
13
# File 'lib/roar-sinatra.rb', line 8

def roar(object, options = {})
  content_type 'application/hal+json'

  representer_class = options[:representer_class] || Object::const_get("#{object.class.name}Representer")
  object.extend(representer_class).to_json
end