class DartTrails::Tilt::Template

Attributes

engine[R]

Public Class Methods

default_mime_type() click to toggle source
# File lib/dart_trails/tilt/template.rb, line 14
def self.default_mime_type
  'application/javascript'
end

Public Instance Methods

evaluate(scope, locals, &block) click to toggle source

Several attributes are available.

#file -> The name/path given for the original file.
         If a block passed to #new in place of a file, this will
         return nil.
#data -> The data read from the file or passed in directly through
         a block.
... (see the source code) ...
# File lib/dart_trails/tilt/template.rb, line 34
def evaluate(scope, locals, &block)
  engine.compile
end
initialize_engine() click to toggle source

Called once, the first time the class is initialized. Use this to require the underlying template library and perform any initial setup.

# File lib/dart_trails/tilt/template.rb, line 11
def initialize_engine
end
prepare() click to toggle source

Implementation of prepare is required by Tilt::Template and is called before evaluate.

# File lib/dart_trails/tilt/template.rb, line 21
def prepare
  @engine = Engine.new(file, data)
end