Class: Handlebars::Template
- Inherits:
-
Object
- Object
- Handlebars::Template
- Defined in:
- lib/ruby-handlebars/template.rb
Instance Method Summary collapse
- #call(args = nil) ⇒ Object
- #call_with_context(ctx) ⇒ Object
-
#initialize(hbs, ast) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(hbs, ast) ⇒ Template
Returns a new instance of Template.
5 6 7 8 |
# File 'lib/ruby-handlebars/template.rb', line 5 def initialize(hbs, ast) @hbs = hbs @ast = ast end |
Instance Method Details
#call(args = nil) ⇒ Object
10 11 12 13 14 |
# File 'lib/ruby-handlebars/template.rb', line 10 def call(args = nil) ctx = Context.new(@hbs, args) @ast.eval(ctx) end |
#call_with_context(ctx) ⇒ Object
16 17 18 |
# File 'lib/ruby-handlebars/template.rb', line 16 def call_with_context(ctx) @ast.eval(ctx) end |