Sha256: fc4b9bd65cd7d31eb684e164023aa7ba18a3b4a588d430c964a21c79ba2b9cb6
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require 'dry/plugins/config' require 'dry/plugins/host/dsl' module Dry module Plugins module Host # Extends a host with plug-ins interfaces class Builder def initialize(registry_method: Plugins.config.registry_method) @registry_method = registry_method end # @return [Symbol] attr_reader :registry_method # @param host [Module] # # @return [Module] # # @example # require 'dry/plugins/module_builder' # # class Host # end # # module_builder = Dry::Plugins::HostExtender.new # module_builder.call(Host) #=> Host::Plugins 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 end end end end
Version data entries
4 entries across 4 versions & 1 rubygems