Sha256: ac4103029ef859a9c3056ac7c2a212942be83b3a4c1df41098386875bf911f3a

Contents?: true

Size: 801 Bytes

Versions: 7

Compression:

Stored size: 801 Bytes

Contents

module Spree
  module Admin
    module MainMenu
      class SectionBuilder
        include ::Spree::Admin::PermissionChecks

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

        def with_label_translation_key(key)
          @label_translation_key = key
          self
        end

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

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spree_backend-4.8.4 app/models/spree/admin/main_menu/section_builder.rb
spree_backend-4.8.3 app/models/spree/admin/main_menu/section_builder.rb
spree_backend-4.8.2 app/models/spree/admin/main_menu/section_builder.rb
spree_backend-4.8.1 app/models/spree/admin/main_menu/section_builder.rb
spree_backend-4.7.2 app/models/spree/admin/main_menu/section_builder.rb
spree_backend-4.7.1 app/models/spree/admin/main_menu/section_builder.rb
spree_backend-4.7.0 app/models/spree/admin/main_menu/section_builder.rb