Sha256: d426f339d76aa8daa38b0b353498bb9815f33d84f4c8b20f0dc406cb53b33438

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

# @api private
# @since 0.1.0
# @version 0.8.1
module SmartCore::Container::Entities::DependencyBuilder
  class << self
    # @param dependency_name [String]
    # @param dependency_definition [Proc]
    # @param memoize [Boolean]
    # @return [SmartCore::Container::Entities::Dependency]
    #
    # @api private
    # @since 0.1.0
    # @version 0.8.1
    def build(dependency_name, dependency_definition, memoize)
      if memoize
        build_memoized_dependency(dependency_name, dependency_definition)
      else
        build_original_dependency(dependency_name, dependency_definition)
      end
    end

    private

    # @param dependency_name [String]
    # @param dependency_definition [Proc]
    # @return [SmartCore::Container::Entities::Dependency]
    #
    # @api private
    # @since 0.8.1
    def build_memoized_dependency(dependency_name, dependency_definition)
      SmartCore::Container::Entities::MemoizedDependency.new(dependency_name, dependency_definition)
    end

    # @param dependency_name [String]
    # @param dependency_definition [Proc]
    # @return [SmartCore::Container::Entities::Dependency]
    #
    # @api private
    # @since 0.8.1
    def build_original_dependency(dependency_name, dependency_definition)
      SmartCore::Container::Entities::Dependency.new(dependency_name, dependency_definition)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
smart_container-0.11.0 lib/smart_core/container/entities/dependency_builder.rb
smart_container-0.10.0 lib/smart_core/container/entities/dependency_builder.rb
smart_container-0.9.0 lib/smart_core/container/entities/dependency_builder.rb
smart_container-0.8.1 lib/smart_core/container/entities/dependency_builder.rb