Sha256: edf5713e4f3a571d31f49258c76768d4f81d90dff7e8eca617b02c2acb207db1

Contents?: true

Size: 468 Bytes

Versions: 1

Compression:

Stored size: 468 Bytes

Contents

module Myth
  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)
        "Myth.preprocess(begin;#{compiled_source};end)"
      end
    end
  end
end

ActiveSupport.on_load(:action_view) do
  ActionView::Template.register_template_handler :myth, Myth::Rails::TemplateHandler
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
myth-rails-1.0.1 lib/myth/rails/template_handler.rb