lib/coffee/rails/template_handler.rb in coffee-rails-4.2.2 vs lib/coffee/rails/template_handler.rb in coffee-rails-5.0.0
- old
+ new
@@ -3,11 +3,15 @@
class TemplateHandler
def self.erb_handler
@@erb_handler ||= ActionView::Template.registered_template_handler(:erb)
end
- def self.call(template)
- compiled_source = erb_handler.call(template)
+ 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
end
end
end