Sha256: 4730730f6ec619ed81eaa8d412248f49b72a2b60c46738ee7aca2c43ac13174f
Contents?: true
Size: 827 Bytes
Versions: 4
Compression:
Stored size: 827 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 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) module Ruhl class Engine private def render_partial template = scope.view_paths.find_template(call_result) raise PartialNotFoundError.new(call_result) unless template render_nodes Nokogiri::HTML.fragment( template.source ) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ruhl-0.11.2 | lib/ruhl/rails.rb |
ruhl-0.11.1 | lib/ruhl/rails.rb |
ruhl-0.11.0 | lib/ruhl/rails.rb |
ruhl-0.10.1 | lib/ruhl/rails.rb |