Sha256: 4de81e91b694385e28d627cfff0889d46deed00873f96220aae7d2b2b12757fd

Contents?: true

Size: 390 Bytes

Versions: 6

Compression:

Stored size: 390 Bytes

Contents

module Light
  module Decorator
    module ViewContext
      def view_context
        super.tap do |context|
          RequestStore[:light_decorator_context] = context
        end
      end

      def self.current
        RequestStore[:light_decorator_context] || fake_context
      end

      # @private
      def self.fake_context
        ActionView::Base.new
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
light-decorator-1.0.1 lib/light/decorator/view_context.rb
light-decorator-1.0.0 lib/light/decorator/view_context.rb
light-decorator-0.5.3 lib/light/decorator/view_context.rb
light-decorator-0.5.2 lib/light/decorator/view_context.rb
light-decorator-0.5.1 lib/light/decorator/view_context.rb
light-decorator-0.5.0 lib/light/decorator/view_context.rb