Class: RgGen::Core::Builder::InputComponentRegistry

Inherits:
ComponentRegistry show all
Defined in:
lib/rggen/core/builder/input_component_registry.rb

Instance Method Summary collapse

Methods inherited from ComponentRegistry

#register_component, #register_global_component

Constructor Details

#initialize(name, builder) ⇒ InputComponentRegistry

Returns a new instance of InputComponentRegistry.



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

def initialize(name, builder)
  super
  @loader_registries = Hash.new do |h, k|
    h[k] = LoaderRegistry.new
  end
end

Instance Method Details

#build_factoryObject



31
32
33
34
35
# File 'lib/rggen/core/builder/input_component_registry.rb', line 31

def build_factory
  factory = super
  factory.loaders(build_loaders)
  factory
end

#define_value_extractor(loader_type, layers = nil, value, &body) ⇒ Object



26
27
28
29
# File 'lib/rggen/core/builder/input_component_registry.rb', line 26

def define_value_extractor(loader_type, layers = nil, value, &body)
  @loader_registries[loader_type]
    .define_value_extractor(layers, value, &body)
end

#register_loader(loader_type, loader) ⇒ Object



14
15
16
# File 'lib/rggen/core/builder/input_component_registry.rb', line 14

def register_loader(loader_type, loader)
  @loader_registries[loader_type].register_loader(loader)
end

#register_loaders(loader_type, loaders) ⇒ Object



18
19
20
# File 'lib/rggen/core/builder/input_component_registry.rb', line 18

def register_loaders(loader_type, loaders)
  @loader_registries[loader_type].register_loaders(loaders)
end

#setup_loader(loader_type) ⇒ Object



22
23
24
# File 'lib/rggen/core/builder/input_component_registry.rb', line 22

def setup_loader(loader_type)
  block_given? && yield(@loader_registries[loader_type])
end