Class: Sitepress::Rendition
- Inherits:
-
Object
- Object
- Sitepress::Rendition
- Defined in:
- lib/sitepress/rendition.rb
Overview
Encapsulates the data needed to render a resource from a controller. This lets us keep the functions in the controller more functional, which makes them easier to override by the end users.
Instance Attribute Summary collapse
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#output ⇒ Object
Returns the value of attribute output.
-
#resource ⇒ Object
Returns the value of attribute resource.
Instance Method Summary collapse
- #handler ⇒ Object
-
#initialize(resource, layout: nil) ⇒ Rendition
constructor
A new instance of Rendition.
- #mime_type ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(resource, layout: nil) ⇒ Rendition
Returns a new instance of Rendition.
8 9 10 |
# File 'lib/sitepress/rendition.rb', line 8 def initialize(resource, layout: nil) @resource = resource end |
Instance Attribute Details
#layout ⇒ Object
Returns the value of attribute layout.
6 7 8 |
# File 'lib/sitepress/rendition.rb', line 6 def layout @layout end |
#output ⇒ Object
Returns the value of attribute output.
6 7 8 |
# File 'lib/sitepress/rendition.rb', line 6 def output @output end |
#resource ⇒ Object
Returns the value of attribute resource.
6 7 8 |
# File 'lib/sitepress/rendition.rb', line 6 def resource @resource end |
Instance Method Details
#handler ⇒ Object
16 17 18 |
# File 'lib/sitepress/rendition.rb', line 16 def handler resource.handler end |
#mime_type ⇒ Object
12 13 14 |
# File 'lib/sitepress/rendition.rb', line 12 def mime_type resource.mime_type.to_s end |
#source ⇒ Object
20 21 22 |
# File 'lib/sitepress/rendition.rb', line 20 def source resource.body end |