Class: Spree::Admin::MainMenu::ItemBuilder

Inherits:
Object
  • Object
show all
Includes:
PermissionChecks
Defined in:
app/models/spree/admin/main_menu/item_builder.rb

Instance Method Summary collapse

Methods included from PermissionChecks

#with_admin_ability_check, #with_availability_check, #with_create_ability_check, #with_fire_ability_check, #with_index_ability_check, #with_manage_ability_check, #with_resend_ability_check, #with_state_change_check, #with_update_ability_check

Constructor Details

#initialize(key, url) ⇒ ItemBuilder

Returns a new instance of ItemBuilder.



7
8
9
10
11
12
13
14
# File 'app/models/spree/admin/main_menu/item_builder.rb', line 7

def initialize(key, url)
  @key = key
  @label_translation_key = key
  @url = url
  @icon_key = nil
  @availability_checks = []
  @match_path = nil
end

Instance Method Details

#build ⇒ Object



31
32
33
# File 'app/models/spree/admin/main_menu/item_builder.rb', line 31

def build
  Item.new(@key, @label_translation_key, @url, @icon_key, @availability_checks, @match_path)
end

#with_icon_key(icon_key) ⇒ Object



21
22
23
24
# File 'app/models/spree/admin/main_menu/item_builder.rb', line 21

def with_icon_key(icon_key)
  @icon_key = icon_key
  self
end

#with_label_translation_key(key) ⇒ Object



16
17
18
19
# File 'app/models/spree/admin/main_menu/item_builder.rb', line 16

def with_label_translation_key(key)
  @label_translation_key = key
  self
end

#with_match_path(match_path) ⇒ Object



26
27
28
29
# File 'app/models/spree/admin/main_menu/item_builder.rb', line 26

def with_match_path(match_path)
  @match_path = match_path
  self
end