Sha256: 59fb575a1ae0580c1351ff5f65a0f9a229a3057e85707004c9f784e4bd2fa5ff

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module SmartCore::Container::DefinitionDSL::Commands::Definition
  # @api private
  # @since 0.1.0
  class Compose < SmartCore::Container::DefinitionDSL::Commands::Base
    # @since 0.1.0
    self.inheritable = true

    # @param container_klass [Class<SmartCore::Container>]
    # @return [void]
    #
    # @api private
    # @since 0.1.0
    def initialize(container_klass)
      raise(
        SmartCore::ArgumentError,
        'Container class should be a subtype of Quantum::Container'
      ) unless container_klass < SmartCore::Container

      @container_klass = container_klass
    end

    # @param registry [SmartCore::Container::Registry]
    # @return [void]
    #
    # @api private
    # @since 0.1.0
    def call(registry)
      SmartCore::Container::RegistryBuilder.build_definitions(container_klass, registry)
    end

    # @return [SmartCore::Container::DefinitionDSL::Commands::Definition::Compose]
    #
    # @api private
    # @since 0.1.0
    def dup
      self.class.new(container_klass)
    end

    private

    # @return [Class<SmartCore::Container>]
    #
    # @api private
    # @since 0.1.0
    attr_reader :container_klass
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smart_container-0.1.0 lib/smart_core/container/definition_dsl/commands/definition/compose.rb