Class: RgGen::Builder::ComponentStore
- Inherits:
-
Object
- Object
- RgGen::Builder::ComponentStore
show all
- Defined in:
- lib/rggen/builder/component_store.rb
Instance Method Summary
collapse
Constructor Details
#initialize(builder, component_name) ⇒ ComponentStore
Returns a new instance of ComponentStore.
4
5
6
7
8
|
# File 'lib/rggen/builder/component_store.rb', line 4
def initialize(builder, component_name)
@builder = builder
@component_name = component_name
@entries = []
end
|
Instance Method Details
#build_factory ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/rggen/builder/component_store.rb', line 20
def build_factory
factories = @entries.map(&:build_factory)
factories.each_cons(2) do |factory_pair|
factory_pair[0].child_factory = factory_pair[1]
end
factories.first.root_factory
factories.first
end
|
#entry(associated_category_or_categories = nil, &body) ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/rggen/builder/component_store.rb', line 10
def entry(associated_category_or_categories = nil, &body)
if associated_category_or_categories.nil?
@entries << create_new_entry(nil, body)
else
Array(associated_category_or_categories).each do |category|
@entries << create_new_entry(category, body)
end
end
end
|