Class: Lotus::View::Template
- Inherits:
-
Object
- Object
- Lotus::View::Template
- Defined in:
- lib/lotus/view/template.rb
Overview
A logic-less template.
Direct Known Subclasses
Instance Method Summary collapse
-
#format ⇒ Symbol
Returns the format that the template handles.
-
#initialize(template) ⇒ Template
constructor
A new instance of Template.
-
#render(scope, &blk) ⇒ String
private
Render the template within the context of the given scope.
Constructor Details
#initialize(template) ⇒ Template
Returns a new instance of Template.
9 10 11 |
# File 'lib/lotus/view/template.rb', line 9 def initialize(template) @_template = Tilt.new(template) end |
Instance Method Details
#format ⇒ Symbol
Returns the format that the template handles.
24 25 26 |
# File 'lib/lotus/view/template.rb', line 24 def format @_template.basename.match(/\.([^.]+)/).captures.first.to_sym end |
#render(scope, &blk) ⇒ String
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.
Render the template within the context of the given scope.
38 39 40 |
# File 'lib/lotus/view/template.rb', line 38 def render(scope, &blk) @_template.render(scope, {}, &blk) end |