Sha256: bba80f912a86c49bb83bf38883f8742ed097364381810692d5592f7426788379

Contents?: true

Size: 434 Bytes

Versions: 1

Compression:

Stored size: 434 Bytes

Contents

module Coffee
  module Rails
    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)
        "CoffeeScript.compile(begin;#{compiled_source};end)"
      end
    end
  end
end

ActionView::Template.register_template_handler :coffee, Coffee::Rails::TemplateHandler

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coffee-rails-3.1.0.rc.6 lib/coffee/rails/template_handler.rb