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.



68
69
70
# File 'lib/garage/hypermedia_responder.rb', line 68

def initialize(controller)
  @controller = controller
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



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

def controller
  @controller
end

Instance Method Details

#content_typeObject



76
77
78
79
# File 'lib/garage/hypermedia_responder.rb', line 76

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

#dictionary?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/garage/hypermedia_responder.rb', line 72

def dictionary?
  controller.representation == :dictionary
end