Class: Sitepress::Renderers::Controller
- Inherits:
-
Object
- Object
- Sitepress::Renderers::Controller
- Defined in:
- lib/sitepress/renderers/controller.rb
Overview
This would be the ideal way to render Sitepress resources, but there’s a lot of hackery involved in getting it to work properly.
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
-
#initialize(resource, controller = SiteController) ⇒ Controller
constructor
A new instance of Controller.
- #render ⇒ Object
Constructor Details
#initialize(resource, controller = SiteController) ⇒ Controller
Returns a new instance of Controller.
8 9 10 11 |
# File 'lib/sitepress/renderers/controller.rb', line 8 def initialize(resource, controller = SiteController) @controller = controller @resource = resource end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
6 7 8 |
# File 'lib/sitepress/renderers/controller.rb', line 6 def controller @controller end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
6 7 8 |
# File 'lib/sitepress/renderers/controller.rb', line 6 def resource @resource end |
Instance Method Details
#render ⇒ Object
13 14 15 16 17 18 |
# File 'lib/sitepress/renderers/controller.rb', line 13 def render renderer.render inline: resource.body, type: resource.handler, layout: resolve_layout, content_type: resource.mime_type.to_s end |