Sha256: d01f67e4a8c02bd8cf437801842e2b65aafe6116ff7d445df4c6e21e0f8dd089

Contents?: true

Size: 523 Bytes

Versions: 2

Compression:

Stored size: 523 Bytes

Contents

module Poirot
  class Handler < ActionView::Template::Handler
    include ActionView::Template::Handlers::Compilable

    self.default_format = :mustache

    def compile(template)
      view_path = "#{template.virtual_path}_view"
      abs_view_path = Rails.root.join('app/views', view_path)
      view_class = begin
        view_path.classify.constantize
      rescue NameError => e
        Poirot::View
      end
      "#{view_class}.new(self, '#{template.source.gsub(/'/, "\\\\'")}').render.html_safe"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
poirot-0.0.2 lib/poirot/handler.rb
poirot-0.0.1 lib/poirot/handler.rb