class Smolbars::Template
Public Class Methods
new(context, fn)
click to toggle source
# File lib/smolbars/template.rb, line 3 def initialize(context, fn) @context, @fn = context, fn end
Public Instance Methods
call(*args, **kwargs)
click to toggle source
# File lib/smolbars/template.rb, line 7 def call(*args, **kwargs) if args.length == 0 invocation = "%s(%s)" % [@fn, kwargs.to_json] else invocation = "%s(%s)" % [@fn, args.first.to_json] end @context.eval(invocation) end