Class: Spree::Admin::MainMenu::Item
- Inherits:
-
Object
- Object
- Spree::Admin::MainMenu::Item
- Defined in:
- app/models/spree/admin/main_menu/item.rb
Instance Attribute Summary collapse
-
#icon_key ⇒ Object
readonly
Returns the value of attribute icon_key.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#label_translation_key ⇒ Object
readonly
Returns the value of attribute label_translation_key.
-
#match_path ⇒ Object
readonly
Returns the value of attribute match_path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #available?(current_ability, resource) ⇒ Boolean
- #children? ⇒ Boolean
-
#initialize(key, label_translation_key, url, icon_key, availability_checks, match_path) ⇒ Item
constructor
rubocop:disable Metrics/ParameterLists.
Constructor Details
#initialize(key, label_translation_key, url, icon_key, availability_checks, match_path) ⇒ Item
rubocop:disable Metrics/ParameterLists
7 8 9 10 11 12 13 14 |
# File 'app/models/spree/admin/main_menu/item.rb', line 7 def initialize(key, label_translation_key, url, icon_key, availability_checks, match_path) # rubocop:disable Metrics/ParameterLists @key = key @label_translation_key = label_translation_key @url = url @icon_key = icon_key @availability_checks = availability_checks @match_path = match_path end |
Instance Attribute Details
#icon_key ⇒ Object (readonly)
Returns the value of attribute icon_key.
5 6 7 |
# File 'app/models/spree/admin/main_menu/item.rb', line 5 def icon_key @icon_key end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'app/models/spree/admin/main_menu/item.rb', line 5 def key @key end |
#label_translation_key ⇒ Object (readonly)
Returns the value of attribute label_translation_key.
5 6 7 |
# File 'app/models/spree/admin/main_menu/item.rb', line 5 def label_translation_key @label_translation_key end |
#match_path ⇒ Object (readonly)
Returns the value of attribute match_path.
5 6 7 |
# File 'app/models/spree/admin/main_menu/item.rb', line 5 def match_path @match_path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'app/models/spree/admin/main_menu/item.rb', line 5 def url @url end |
Instance Method Details
#available?(current_ability, resource) ⇒ Boolean
16 17 18 19 20 21 22 |
# File 'app/models/spree/admin/main_menu/item.rb', line 16 def available?(current_ability, resource) return true if @availability_checks.empty? result = @availability_checks.map { |check| check.call(current_ability, resource) } result.all?(true) end |
#children? ⇒ Boolean
24 25 26 |
# File 'app/models/spree/admin/main_menu/item.rb', line 24 def children? false end |