Sha256: 3bbdbd1bc19accf9b50934ba99067a1e71e6757bdf8c61ff8daec77e6c077825

Contents?: true

Size: 654 Bytes

Versions: 1

Compression:

Stored size: 654 Bytes

Contents

require 'ruhl'

module Ruhl
  class Plugin < ActionView::TemplateHandler

    def initialize(action_view)
      @action_view = action_view
    end
    
    def render(template, options = {})
      layout = @action_view.controller.send(:active_layout)

      options[:layout]        = layout.filename
      options[:layout_source] = layout.source

      Rails.logger.info("calling ruhl. template: #{template.inspect}\n options: #{options.inspect}")
      Ruhl::Engine.new(template.source, options).render(@action_view)
    end
  end
end

ActionView::Template.register_template_handler(:ruhl, Ruhl::Plugin)

ActionView::Template.exempt_from_layout(:ruhl)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruhl-0.9.4 lib/ruhl/rails.rb