Module: Lotus::View::Rendering::InstanceMethods
- Defined in:
- lib/lotus/view/rendering.rb
Overview
Instance Method Summary collapse
-
#initialize(template, locals) ⇒ Object
Initialize a view.
-
#render ⇒ String
Render the template by bounding the local scope.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m) ⇒ Object (protected)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Delegates missing methods to the scope.
176 177 178 |
# File 'lib/lotus/view/rendering.rb', line 176 def method_missing(m) @scope.__send__ m end |
Instance Method Details
#initialize(template, locals) ⇒ Object
Initialize a view
38 39 40 41 42 |
# File 'lib/lotus/view/rendering.rb', line 38 def initialize(template, locals) @template = template @locals = locals @scope = Scope.new(self, @locals) end |
#render ⇒ String
Render the template by bounding the local scope. If it uses a layout, it renders the template first and then the control passes to the layout.
Override this method for custom rendering policies. For instance, when a serializer is used and there isn’t the need of a template.
103 104 105 |
# File 'lib/lotus/view/rendering.rb', line 103 def render layout.render end |