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.
66 67 68 |
# File 'lib/garage/hypermedia_responder.rb', line 66 def initialize(controller) @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (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_type ⇒ Object
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
70 71 72 |
# File 'lib/garage/hypermedia_responder.rb', line 70 def dictionary? controller.representation == :dictionary end |