Class: Dry::Plugins::ModuleBuilder
- Inherits:
-
Object
- Object
- Dry::Plugins::ModuleBuilder
- Defined in:
- lib/dry/plugins/module_builder.rb
Overview
Builds a Module
containing all plug-ins for host
Instance Attribute Summary collapse
- #plugins_module_name ⇒ Symbol readonly
Instance Method Summary collapse
- #call(host) ⇒ Module
-
#initialize(plugins_module_name: Plugins.config.plugins_module_name) ⇒ ModuleBuilder
constructor
A new instance of ModuleBuilder.
Constructor Details
#initialize(plugins_module_name: Plugins.config.plugins_module_name) ⇒ ModuleBuilder
Returns a new instance of ModuleBuilder.
10 11 12 |
# File 'lib/dry/plugins/module_builder.rb', line 10 def initialize(plugins_module_name: Plugins.config.plugins_module_name) @plugins_module_name = plugins_module_name end |
Instance Attribute Details
#plugins_module_name ⇒ Symbol (readonly)
15 16 17 |
# File 'lib/dry/plugins/module_builder.rb', line 15 def plugins_module_name @plugins_module_name end |
Instance Method Details
#call(host) ⇒ Module
29 30 31 32 33 34 35 36 |
# File 'lib/dry/plugins/module_builder.rb', line 29 def call(host) plugins = if host.const_defined?(plugins_module_name) host.const_get(plugins_module_name) else host.const_set(plugins_module_name, Module.new) end plugins end |