Class: RgGen::Core::Builder::Builder
- Extended by:
- Forwardable
- Defined in:
- lib/rggen/core/builder/builder.rb
Instance Attribute Summary collapse
-
#plugin_manager ⇒ Object
readonly
Returns the value of attribute plugin_manager.
Instance Method Summary collapse
- #add_feature_registry(name, target_layer, registry) ⇒ Object
- #build_factories(type, targets) ⇒ Object
- #build_factory(type, component) ⇒ Object
- #delete(layer) ⇒ Object
- #disable_all ⇒ Object
- #disable_unused_output_features(used_writers) ⇒ Object
- #enable(layer) ⇒ Object
- #enable_all ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #input_component_registry(name) ⇒ Object
- #output_component_registry(name) ⇒ Object
- #register_input_components ⇒ Object
- #register_map_layers ⇒ Object
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
9 10 11 12 13 |
# File 'lib/rggen/core/builder/builder.rb', line 9 def initialize initialize_component_registries initialize_layers @plugin_manager = PluginManager.new(self) end |
Instance Attribute Details
#plugin_manager ⇒ Object (readonly)
Returns the value of attribute plugin_manager.
15 16 17 |
# File 'lib/rggen/core/builder/builder.rb', line 15 def plugin_manager @plugin_manager end |
Instance Method Details
#add_feature_registry(name, target_layer, registry) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rggen/core/builder/builder.rb', line 38 def add_feature_registry(name, target_layer, registry) target_layers = if target_layer Array(@layers[target_layer]) else @layers.values end target_layers .each { |layer| layer.add_feature_registry(name, registry) } end |
#build_factories(type, targets) ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'lib/rggen/core/builder/builder.rb', line 90 def build_factories(type, targets) registries = if targets.empty? @component_registries[type] else collect_component_registries(type, targets) end registries.each_value.map(&:build_factory) end |
#build_factory(type, component) ⇒ Object
86 87 88 |
# File 'lib/rggen/core/builder/builder.rb', line 86 def build_factory(type, component) @component_registries[type][component].build_factory end |
#delete(layer) ⇒ Object
100 101 102 |
# File 'lib/rggen/core/builder/builder.rb', line 100 def delete(layer, ...) @layers.key?(layer) && @layers[layer].delete(...) end |
#disable_all ⇒ Object
72 73 74 |
# File 'lib/rggen/core/builder/builder.rb', line 72 def disable_all @layers.each_value(&:disable_all) end |
#disable_unused_output_features(used_writers) ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/rggen/core/builder/builder.rb', line 76 def disable_unused_output_features(used_writers) return if used_writers.empty? @component_registries[:output].each do |name, registry| next if used_writers.include?(name) registry.disable_all_features end end |
#enable(layer) ⇒ Object
64 65 66 |
# File 'lib/rggen/core/builder/builder.rb', line 64 def enable(layer, ...) @layers[layer].enable(...) end |
#enable_all ⇒ Object
68 69 70 |
# File 'lib/rggen/core/builder/builder.rb', line 68 def enable_all @layers.each_value(&:enable_all) end |
#input_component_registry(name) ⇒ Object
17 18 19 |
# File 'lib/rggen/core/builder/builder.rb', line 17 def input_component_registry(name, &) component_registry(:input, name, &) end |
#output_component_registry(name) ⇒ Object
21 22 23 |
# File 'lib/rggen/core/builder/builder.rb', line 21 def output_component_registry(name, &) component_registry(:output, name, &) end |
#register_input_components ⇒ Object
104 105 106 107 |
# File 'lib/rggen/core/builder/builder.rb', line 104 def register_input_components Configuration.setup(self) RegisterMap.setup(self) end |
#register_map_layers ⇒ Object
34 35 36 |
# File 'lib/rggen/core/builder/builder.rb', line 34 def register_map_layers REGISTER_MAP_LAYERS end |