Class: DartTrails::Tilt::Template

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/dart_trails/tilt/template.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#engineObject (readonly)

Returns the value of attribute engine.



5
6
7
# File 'lib/dart_trails/tilt/template.rb', line 5

def engine
  @engine
end

Class Method Details

.default_mime_typeObject



14
15
16
# File 'lib/dart_trails/tilt/template.rb', line 14

def self.default_mime_type
  'application/javascript'
end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object

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) ...


34
35
36
# File 'lib/dart_trails/tilt/template.rb', line 34

def evaluate(scope, locals, &block)
  engine.compile
end

#initialize_engineObject

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



11
12
# File 'lib/dart_trails/tilt/template.rb', line 11

def initialize_engine
end

#prepareObject

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



21
22
23
# File 'lib/dart_trails/tilt/template.rb', line 21

def prepare
  @engine = Engine.new(file, data)
end