Class: RgGen::Core::Builder::ComponentRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/rggen/core/builder/component_registry.rb

Instance Method Summary collapse

Constructor Details

#initialize(component_name, builder) ⇒ ComponentRegistry

Returns a new instance of ComponentRegistry.



7
8
9
10
11
# File 'lib/rggen/core/builder/component_registry.rb', line 7

def initialize(component_name, builder)
  @component_name = component_name
  @builder = builder
  @entries = []
end

Instance Method Details

#build_factoryObject



23
24
25
# File 'lib/rggen/core/builder/component_registry.rb', line 23

def build_factory
  build_factories.first.tap(&:root_factory)
end

#register_component(layers = nil, &block) ⇒ Object



13
14
15
16
17
# File 'lib/rggen/core/builder/component_registry.rb', line 13

def register_component(layers = nil, &block)
  Array(layers || @builder.register_map_layers).each do |layer|
    @entries << create_new_entry(layer, &block)
  end
end

#register_global_component(&block) ⇒ Object



19
20
21
# File 'lib/rggen/core/builder/component_registry.rb', line 19

def register_global_component(&block)
  @entries << create_new_entry(nil, &block)
end