Class: ActiveTools::ActionPack::ActionController::PathHelper::HttpReferer
- Inherits:
-
Object
- Object
- ActiveTools::ActionPack::ActionController::PathHelper::HttpReferer
- Includes:
- ComplexHelpers
- Defined in:
- lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb
Instance Attribute Summary collapse
-
#recognized ⇒ Object
readonly
Returns the value of attribute recognized.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #current_action ⇒ Object
- #current_controller ⇒ Object
-
#initialize(request, environment = {}) ⇒ HttpReferer
constructor
A new instance of HttpReferer.
- #to_s ⇒ Object
Methods included from ComplexHelpers
#action?, #controller?, #path?
Constructor Details
#initialize(request, environment = {}) ⇒ HttpReferer
Returns a new instance of HttpReferer.
13 14 15 16 17 18 19 20 21 |
# File 'lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb', line 13 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 |
Instance Attribute Details
#recognized ⇒ Object (readonly)
Returns the value of attribute recognized.
8 9 10 |
# File 'lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb', line 8 def recognized @recognized end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb', line 8 def url @url end |
Instance Method Details
#current_action ⇒ Object
27 28 29 |
# File 'lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb', line 27 def current_action recognized[:action] end |
#current_controller ⇒ Object
23 24 25 |
# File 'lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb', line 23 def current_controller recognized[:controller] end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/active_tools/action_pack/action_controller/path_helper/http_referer.rb', line 31 def to_s @url end |