Module: TinyTemplate::Utils

Defined in:
lib/tiny_template.rb

Instance Method Summary collapse

Instance Method Details

#TinyTemplate(str, context = nil) ⇒ Object

Call this method with or without context. If no context is passed, the context of the caller will be computed and passed to a new instance of the class TinyTemplate



41
42
43
44
45
46
47
48
49
# File 'lib/tiny_template.rb', line 41

def TinyTemplate(str, context = nil)
  unless context
    RubyVM::DebugInspector.open do |inspector|
      context = eval('self', inspector.frame_binding(2))
    end
  end

  TinyTemplate.parse(str, context)
end