Sha256: 174b899cd434b57fe27d980d46d2daab8bf83f94ba141e9a3a20017c852d00e0

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

# @api private
# @since 0.1.0
module SmartCore::Container::DependencyCompatability::Definition
  class << self
    # @since 0.1.0
    include SmartCore::Container::DependencyCompatability::General

    # @param container_klass [Class<SmartCore::Container>]
    # @param dependency_name [String, Symbol]
    # @return [Boolean]
    #
    # @api private
    # @since 0.1.0
    # rubocop:disable Lint/EmptyBlock
    def potential_namespace_overlap?(container_klass, dependency_name)
      anonymous_container = Class.new(container_klass).new
      anonymous_container.register(dependency_name, &(proc {}))
      false
    rescue SmartCore::Container::DependencyOverNamespaceOverlapError
      true
    end
    # rubocop:enable Lint/EmptyBlock

    # @param container_klass [Class<SmartCore::Container>]
    # @param namespace_name [String, Symbol]
    # @return [Boolean]
    #
    # @api private
    # @since 0.1.0
    # rubocop:disable Lint/EmptyBlock
    def potential_dependency_overlap?(container_klass, namespace_name)
      anonymous_container = Class.new(container_klass).new
      anonymous_container.namespace(namespace_name, &(proc {}))
      false
    rescue SmartCore::Container::NamespaceOverDependencyOverlapError
      true
    end
    # rubocop:enable Lint/EmptyBlock
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smart_container-0.9.0 lib/smart_core/container/dependency_compatability/definition.rb