class Inky::Rails::TemplateHandler

Public Class Methods

new(compose_with = nil) click to toggle source
# File lib/inky/rails/template_handler.rb, line 4
def initialize(compose_with = nil)
  @engine_handler = ActionView::Template.registered_template_handler(compose_with) if compose_with
end

Public Instance Methods

call(template, source = nil) click to toggle source
# File lib/inky/rails/template_handler.rb, line 16
def call(template, source = nil)
  compiled_source =
    if source
      engine_handler.call(template, source)
    else
      engine_handler.call(template)
    end
  "Inky::Core.new.release_the_kraken(begin; #{compiled_source};end)"
end
engine_handler() click to toggle source
# File lib/inky/rails/template_handler.rb, line 8
def engine_handler
  return @engine_handler if @engine_handler

  type = ::Inky.configuration.template_engine
  ActionView::Template.registered_template_handler(type) ||
    raise("No template handler found for #{type}")
end