Class: ActiveElement::ActiveMenuLink
- Inherits:
-
Object
- Object
- ActiveElement::ActiveMenuLink
- Defined in:
- lib/active_element/active_menu_link.rb
Overview
Detects which link should be highlighted in the main application menu.
Instance Method Summary collapse
-
#active? ⇒ Boolean
rubocop:enable Metrics/ParameterLists.
-
#initialize(rails_component:, current_path:, controller_path:, action_name:, current_navbar_item:, navbar_items:) ⇒ ActiveMenuLink
constructor
rubocop:disable Metrics/ParameterLists.
Constructor Details
#initialize(rails_component:, current_path:, controller_path:, action_name:, current_navbar_item:, navbar_items:) ⇒ ActiveMenuLink
rubocop:disable Metrics/ParameterLists
7 8 9 10 11 12 13 14 |
# File 'lib/active_element/active_menu_link.rb', line 7 def initialize(rails_component:, current_path:, controller_path:, action_name:, current_navbar_item:, navbar_items:) @rails_component = rails_component @current_path = current_path @controller_path = controller_path @action_name = action_name @current_navbar_item = @navbar_items = end |
Instance Method Details
#active? ⇒ Boolean
rubocop:enable Metrics/ParameterLists
17 18 19 20 21 22 23 |
# File 'lib/active_element/active_menu_link.rb', line 17 def active? return true if exact_match? return true if !any_exact_match? && exact_without_query_string_match? return true if !any_exact_match? && !any_exact_without_query_string_match? && exact_without_resource_match? false end |