Class: Spree::Admin::MainMenu::SectionBuilder

Inherits:
Object
  • Object
show all
Includes:
PermissionChecks
Defined in:
app/models/spree/admin/main_menu/section_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, icon_key) ⇒ SectionBuilder

Returns a new instance of SectionBuilder.



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

def initialize(key, icon_key)
  @key =                   key
  @label_translation_key = key
  @icon_key =              icon_key
  @availability_checks =   []
  @items =                 []
end

Instance Method Details

#build ⇒ Object



30
31
32
# File 'app/models/spree/admin/main_menu/section_builder.rb', line 30

def build
  Section.new(@key, @label_translation_key, @icon_key, @availability_checks, @items)
end

#with_item(item) ⇒ Object



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

def with_item(item)
  @items << item
  self
end

#with_items(items) ⇒ Object



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

def with_items(items)
  @items += items
  self
end

#with_label_translation_key(key) ⇒ Object



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

def with_label_translation_key(key)
  @label_translation_key = key
  self
end