Class: Tilt::CoffeeScriptTemplate

Inherits:
StaticTemplate show all
Defined in:
lib/tilt/coffee.rb

Overview

CoffeeScript template implementation. See: coffeescript.org/

CoffeeScript templates do not support object scopes, locals, or yield.

Direct Known Subclasses

CoffeeScriptLiterateTemplate

Class Attribute Summary collapse

Attributes inherited from Template

#compiled_path, #data, #file, #line, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StaticTemplate

#allows_script?, #compiled_method, #render, subclass

Methods inherited from Template

#basename, #compiled_method, default_mime_type, default_mime_type=, #eval_file, #initialize, metadata, #metadata, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Class Attribute Details

.default_bareObject

Returns the value of attribute default_bare.



15
16
17
# File 'lib/tilt/coffee.rb', line 15

def default_bare
  @default_bare
end

Class Method Details

.literate?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/tilt/coffee.rb', line 18

def self.literate?
  false
end

Instance Method Details

#prepareObject



22
23
24
25
26
27
28
# File 'lib/tilt/coffee.rb', line 22

def prepare
  if !@options.key?(:bare) and !@options.key?(:no_wrap)
    @options[:bare] = self.class.default_bare
  end
  @options[:literate] ||= self.class.literate?
  @output = CoffeeScript.compile(@data, @options)
end