Sha256: dfbc7ec3644a971dc5e511ea8b44b7a85ae051224de8b6373ffd4edd0440a21d
Contents?: true
Size: 862 Bytes
Versions: 3
Compression:
Stored size: 862 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(tag, code) file = execute_ruby(tag, code) template = scope.view_paths.find_template(file) raise PartialNotFoundError.new(file) unless template render_nodes Nokogiri::HTML.fragment( template.source ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruhl-0.10.0 | lib/ruhl/rails.rb |
ruhl-0.9.7 | lib/ruhl/rails.rb |
ruhl-0.9.6 | lib/ruhl/rails.rb |