Sha256: f5cb87f85076fa8806d2540c79c32b259de4ee27cf2ad4186a3a0bb6efa7e3cb

Contents?: true

Size: 953 Bytes

Versions: 45

Compression:

Stored size: 953 Bytes

Contents

require 'active_tools/action_pack/action_controller/path_helper/complex_helpers'

module ActiveTools
  module ActionPack
    module ActionController
      module PathHelper
        class HttpReferer
          attr_reader :url, :recognized
          include ComplexHelpers
          
          delegate :[], :to => :recognized
          
          def initialize(request, environment = {})
            @url = request.env['HTTP_REFERER']
            @recognized = begin
              @url.present? ? Rails.application.routes.recognize_path(@url, environment) : {}
            rescue ::ActionController::RoutingError
              {}
            end
            @recognized.freeze
          end

          def current_controller
            recognized[:controller]
          end

          def current_action
            recognized[:action]
          end
          
          def to_s
            @url
          end
        end
      end
    end
  end

end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
active_tools-0.2.5 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.2.4 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.2.3 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.2.2 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.2.1 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.2.0 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.1.4 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.1.3 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.1.2 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.1.1 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.1.0 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.52 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.51 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.50 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.42 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.41 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.40 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.39 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.38 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.37 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb