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.0.36 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.35 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.34 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.33 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.32 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.31 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.30 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.29 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.28 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.27 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.26 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.25 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.24 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.22 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.21 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.20 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.19 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.18 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.17 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
active_tools-0.0.16 lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb