Sha256: 9cae966d9ec28dd60cd9cf7f576b96e7e577f6317d03370719b20f4a6c01310d

Contents?: true

Size: 834 Bytes

Versions: 3

Compression:

Stored size: 834 Bytes

Contents

module KirguduBase
	class DynamicPages::MenuSectionBuilder < ::KirguduBase::DynamicPages::PageElementBuilder

		def initialize(&block)

			self.builder_options.merge!({
				                            label: nil,
				                            items: nil
			                            })

			super(nil, &block)
		end

		def label(value)
			self.builder_options[:label] = value
		end

		def items(&block)
			elements = ::KirguduBase::DynamicPages::MenuItemsBlockBuilder.new(&block).to_elements

			elements.each do |element|
				self.builder_options[:items] = [] unless self.builder_options[:items]
				self.builder_options[:items] << element
			end
		end

		def to_element
			element = ::KirguduBase::DynamicPages::MenuSection.new
			self.build_element(element)
			self.validate_generated_element(element)
			element
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kirgudu_base-0.0.25 app/models/kirgudu_base/dynamic_pages/menu_section_builder.rb
kirgudu_base-0.0.23 app/models/kirgudu_base/dynamic_pages/menu_section_builder.rb
kirgudu_base-0.0.22 app/models/kirgudu_base/dynamic_pages/menu_section_builder.rb