Sha256: 2dcc8146cd89e74ff0bad368df870d886ac4780072e3556497a875b41c092bf4

Contents?: true

Size: 760 Bytes

Versions: 38

Compression:

Stored size: 760 Bytes

Contents

module Unpoly
  module Rails
    ##
    # This adds two methods `#up` and `#up?` to all controllers,
    # helpers and views, allowing the server to inspect the current request
    # for Unpoly-related concerns such as "is this a page fragment update?".
    module InspectorAccessor

      def self.included(base)
        base.helper_method :up, :up?
      end

      def up
        @up_inspector ||= Inspector.new(self)
      end

      alias_method :unpoly, :up

      ##
      # :method: up?
      # Returns whether the current request is an
      # [page fragment update](https://unpoly.com/up.replace) triggered by an
      # Unpoly frontend.
      delegate :up?, :unpoly?, :to => :up

      ActionController::Base.send(:include, self)

    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
unpoly-rails-1.0.3 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-1.0.1 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-1.0.0 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.62.1 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.62.0 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.61.1 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.61.0 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.60.3 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.60.2 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.60.1 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.60.0 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.57.0 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.56.7 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.56.6 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.56.5 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.56.4 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.56.3 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.56.2 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.56.1 lib/unpoly/rails/inspector_accessor.rb
unpoly-rails-0.56.0 lib/unpoly/rails/inspector_accessor.rb