Class: Coffee::Rails::TemplateHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/coffee/rails/template_handler.rb

Class Method Summary collapse

Class Method Details

.call(template, source = nil) ⇒ Object


8
9
10
11
12
13
14
15
# File 'lib/coffee/rails/template_handler.rb', line 8

def self.call(template, source = nil)
  compiled_source = if source
    erb_handler.call(template, source)
  else
    erb_handler.call(template)
  end
  "CoffeeScript.compile(begin;#{compiled_source};end)"
end

.erb_handlerObject


4
5
6
# File 'lib/coffee/rails/template_handler.rb', line 4

def self.erb_handler
  @@erb_handler ||= ActionView::Template.registered_template_handler(:erb)
end