Class: Garage::HypermediaResponder::Representation

Inherits:
Object
  • Object
show all
Defined in:
lib/garage/hypermedia_responder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ Representation

Returns a new instance of Representation.



66
67
68
# File 'lib/garage/hypermedia_responder.rb', line 66

def initialize(controller)
  @controller = controller
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



64
65
66
# File 'lib/garage/hypermedia_responder.rb', line 64

def controller
  @controller
end

Instance Method Details

#content_typeObject



74
75
76
77
# File 'lib/garage/hypermedia_responder.rb', line 74

def content_type
  mime, payload = controller.request.format.to_s.split("/", 2)
  "#{mime}/vnd.cookpad.dictionary+#{payload}"
end

#dictionary?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/garage/hypermedia_responder.rb', line 70

def dictionary?
  controller.representation == :dictionary
end