Sha256: ad0b005e9f26a6ac5b7b327e44c43f37b3cc0043cd0cb60251f2ae9c3cd8c370
Contents?: true
Size: 863 Bytes
Versions: 7
Compression:
Stored size: 863 Bytes
Contents
require 'ruhl' require 'ruhl/rails/ruhl_presenter' 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
7 entries across 7 versions & 1 rubygems