Sha256: 0f0df1c64326f8e9740f89a3d0d4a961a2682f0255eb386ffa729187224133b3

Contents?: true

Size: 978 Bytes

Versions: 4

Compression:

Stored size: 978 Bytes

Contents

# frozen_string_literal: true

require 'dry/plugins/config'
require 'dry/plugins/host/dsl'

module Dry
  module Plugins
    # Plug-ins builder
    # @see Builder#call
    class Builder
      # @!method module_builder
      #   @return [ModuleBuilder]
      #
      # @!method registry_builder
      #   @return [Registry::Builder]
      #
      # @!method host_builder
      #   @return [Host::Builder]
      include Import[:module_builder, :registry_builder, :host_builder]

      # Build a plug-in registry for given `host`
      #
      # 1. Extend `host` with a {Host::DSL plug-ins host DSL}
      # 2. Create a {Registry plug-ins registry} for `host`,
      #    Find or create a `Module` containing plug-ins for `host`,
      #    and extend it with {DSL plug-ins registry DSL}
      #
      # @param host [Module]
      # @return [Registry]
      def call(host, registry: registry_builder.call(host))
        host_builder.call(host, registry)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-plugins-0.4.0 lib/dry/plugins/builder.rb
dry-plugins-0.3.0 lib/dry/plugins/builder.rb
dry-plugins-0.2.0 lib/dry/plugins/builder.rb
dry-plugins-0.1.0 lib/dry/plugins/builder.rb