class PORTL::Template
@!attribute data
Template source; loaded from a file or given directly. @return [String] The content of the template.
@!attribute file
The name of the file where the template data was loaded from. @return [String] Full path to the file.
@!attribute line
The line number in #file where template data was loaded from. @return [Integer] Line number.
@!attribute options
A Hash of template engine specific options. @return [Hash] Options used to compile the template.
Public Instance Methods
evaluate(scope, locals)
click to toggle source
Execute the compiled template and return the result string. Template
evaluation is guaranteed to be performed in the scope object with the locals specified and with support for yielding to the block.
# File lib/portl/template.rb, line 37 def evaluate(scope, locals) @output ||= PORTL.compile(data, scope, options) end
prepare()
click to toggle source
Prepares the template. This is called immediately after the data is loaded. Instance variables set in this method are available to evaluate
when it is called.
@note If this isn’t overridden an exception will be raised.
# File lib/portl/template.rb, line 28 def prepare # nothing to see here, move along, oh my God, what is this?? # huddle around everybody! come closer and take a look at this empty # method. end