Class: Garage::HypermediaResponder::Representation
- Inherits:
-
Object
- Object
- Garage::HypermediaResponder::Representation
- Defined in:
- lib/garage/hypermedia_responder.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
- #content_type ⇒ Object
- #dictionary? ⇒ Boolean
-
#initialize(controller) ⇒ Representation
constructor
A new instance of Representation.
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
#controller ⇒ Object (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_type ⇒ Object
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
72 73 74 |
# File 'lib/garage/hypermedia_responder.rb', line 72 def dictionary? controller.representation == :dictionary end |