Class: Dry::Plugins::Host::Builder
- Inherits:
-
Object
- Object
- Dry::Plugins::Host::Builder
- Defined in:
- lib/dry/plugins/host/builder.rb
Overview
Extends a host with plug-ins interfaces
Instance Attribute Summary collapse
- #registry_method ⇒ Symbol readonly
Instance Method Summary collapse
- #call(host, registry) ⇒ Module
-
#initialize(registry_method: Plugins.config.registry_method) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(registry_method: Plugins.config.registry_method) ⇒ Builder
Returns a new instance of Builder.
11 12 13 |
# File 'lib/dry/plugins/host/builder.rb', line 11 def initialize(registry_method: Plugins.config.registry_method) @registry_method = registry_method end |
Instance Attribute Details
#registry_method ⇒ Symbol (readonly)
16 17 18 |
# File 'lib/dry/plugins/host/builder.rb', line 16 def registry_method @registry_method end |
Instance Method Details
#call(host, registry) ⇒ Module
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dry/plugins/host/builder.rb', line 30 def call(host, registry) unless host.respond_to? registry_method host.define_singleton_method registry_method do registry end end unless host.singleton_class.included_modules.include? Host::DSL host.extend Host::DSL end host end |