Sha256: b82775afde1e311604f2a38cd2a42ec31a231f9985e20ca6f267ded3dcfc5851

Contents?: true

Size: 438 Bytes

Versions: 7

Compression:

Stored size: 438 Bytes

Contents

module Poirot
  class Handler
    def self.call(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
        Rails.logger.info ">>> #{e}"
        Poirot::View
      end
      "#{view_class}.new(self, '#{template.source.gsub(/'/, "\\\\'")}').render.html_safe"
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
nulogy-poirot-0.2.4.1 lib/poirot/handler.rb
poirot-0.2.4 lib/poirot/handler.rb
poirot-0.2.3 lib/poirot/handler.rb
poirot-0.2.2 lib/poirot/handler.rb
poirot-0.2.1 lib/poirot/handler.rb
poirot-0.2.0 lib/poirot/handler.rb
poirot-0.1.0 lib/poirot/handler.rb