Class: Handlebars::Engine::Function
- Inherits:
-
Object
- Object
- Handlebars::Engine::Function
- Defined in:
- lib/handlebars/engine/function.rb
Overview
A proxy for a JavaScript function defined in the context.
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(context, name, logger: nil) ⇒ Function
constructor
A new instance of Function.
Constructor Details
#initialize(context, name, logger: nil) ⇒ Function
Returns a new instance of Function.
7 8 9 10 11 |
# File 'lib/handlebars/engine/function.rb', line 7 def initialize(context, name, logger: nil) @context = context @logger = logger @name = name end |
Instance Method Details
#call(*args) ⇒ Object
13 14 15 16 |
# File 'lib/handlebars/engine/function.rb', line 13 def call(*args) @logger&.debug { "[handlebars] calling #{@name} with args #{args}" } @context.call(@name, *args) end |