Class: Handlebars::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/handlebars/template.rb

Instance Method Summary collapse

Constructor Details

#initialize(context, fn) ⇒ Template

Returns a new instance of Template.



3
4
5
# File 'lib/handlebars/template.rb', line 3

def initialize(context, fn)
  @context, @fn = context, fn
end

Instance Method Details

#call(*args) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/handlebars/template.rb', line 7

def call(*args)
  current = Handlebars::Context.current
  Handlebars::Context.current = @context
  @fn.call(*args)
ensure
  Handlebars::Context.current = current
end