Class: MarionetteDust::TiltDust

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/dust_engine/tilt_dust.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_mime_typeObject



5
6
7
# File 'lib/dust_engine/tilt_dust.rb', line 5

def self.default_mime_type
  'application/javascript'
end

Instance Method Details

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



9
10
11
12
13
14
15
16
17
18
# File 'lib/dust_engine/tilt_dust.rb', line 9

def evaluate(scope, locals, &block)
  template_name = scope.logical_path.to_s.gsub('"', "")
  compiled = Dust.precompile(data, template_name)
  <<-TEMPLATE
    (function(ctx, callback) {
      dust.loadSource(#{compiled.inspect});
      dust.render('#{template_name}', ctx, callback);
    })
  TEMPLATE
end

#prepareObject



20
# File 'lib/dust_engine/tilt_dust.rb', line 20

def prepare; end