Sha256: 67156bd74d9d787b4f06ec435f5c00e12aae52ac311a620d1b850005b8f488c0

Contents?: true

Size: 1.86 KB

Versions: 12

Compression:

Stored size: 1.86 KB

Contents

# frozen_string_literal: true

# @api private
# @since 0.1.0
module SmartCore::Container::DependencyCompatability::General
  # @param context [Class<SmartCore::Container>, SmartCore::Container::Registry]
  # @param dependency_name [String, Symbol]
  # @return [void]
  #
  # @raise [SmartCore::Container::DependencyOverNamespaceOverlapError]
  #
  # @api private
  # @since 0.1.0
  def prevent_namespace_overlap!(context, dependency_name)
    raise(
      SmartCore::Container::DependencyOverNamespaceOverlapError,
      "Trying to overlap already registered '#{dependency_name}' namespace " \
      "with '#{dependency_name}' dependency!"
    ) if potential_namespace_overlap?(context, dependency_name)
  end

  # @param context [Class<SmartCore::Container>, SmartCore::Container::Registry]
  # @param namespace_name [String, Symbol]
  # @return [void]
  #
  # @raise [SmartCore::Container::NamespaceOverDependencyOverlapError]
  #
  # @api private
  # @since 0.1.0
  def prevent_dependency_overlap!(context, namespace_name)
    raise(
      SmartCore::Container::NamespaceOverDependencyOverlapError,
      "Trying to overlap already registered '#{namespace_name}' dependency " \
      "with '#{namespace_name}' namespace!"
    ) if potential_dependency_overlap?(context, namespace_name)
  end

  # @param context [Class<SmartCore::Container>, SmartCore::Container::Registry]
  # @param dependency_name [String, Symbol]
  # @return [Boolean]
  #
  # @api private
  # @since 0.1.0
  def potential_namespace_overlap?(context, dependency_name)
    # :nocov:
    raise NoMethodError
    # :nocov:
  end

  # @param context [Class<SmartCore::Container>, SmartCore::Container::Registry]
  # @param namespace_name [String, Symbol]
  # @return [Boolean]
  #
  # @api private
  # @since 0.1.0
  def potential_dependency_overlap?(context, namespace_name)
    # :nocov:
    raise NoMethodError
    # :nocov:
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
smart_container-0.11.0 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.10.0 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.9.0 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.8.1 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.8.0 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.7.0 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.6.0 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.5.0 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.4.0 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.3.0 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.2.0 lib/smart_core/container/dependency_compatability/general.rb
smart_container-0.1.0 lib/smart_core/container/dependency_compatability/general.rb