Sha256: e00be178213cd7c9752ecd9b8613ec6d9af99be9efeb49285928d0b9fd5f796a

Contents?: true

Size: 798 Bytes

Versions: 2

Compression:

Stored size: 798 Bytes

Contents

module PufferPages
  module Extensions
    module Renderer
      extend ActiveSupport::Concern

      included do
        alias_method_chain :render, :puffer_pages
      end

      def render_with_puffer_pages(context, options)
        if options.key?(:puffer_page) && options[:puffer_page].is_a?(PufferPages::Page)
          render_puffer_page(context, options)
        else
          render_without_puffer_pages(context, options)
        end
      end

      def render_puffer_page(context, options)
        _puffer_page_renderer.render(context, options)
      end

    private

      def _puffer_page_renderer #:nodoc:
        @_puffer_page_renderer ||= PufferPages::Renderer.new(@lookup_context)
      end
    end
  end
end

ActionView::Renderer.send :include, PufferPages::Extensions::Renderer

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puffer_pages-0.5.1 lib/puffer_pages/extensions/renderer.rb
puffer_pages-0.5.0 lib/puffer_pages/extensions/renderer.rb