Class: Dry::Core::Container::Item::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/core/container/item/factory.rb

Overview

Factory for create an Item to register inside of container

Instance Method Summary collapse

Instance Method Details

#call(item, options = {}) ⇒ Dry::Core::Container::Item::Base

Creates an Item Memoizable or Callable

Parameters:

  • item (Mixed)
  • options (Hash) (defaults to: {})

Returns:

  • (Dry::Core::Container::Item::Base)

Raises:



18
19
20
21
22
23
24
# File 'lib/dry/core/container/item/factory.rb', line 18

def call(item, options = {})
  if options[:memoize]
    Item::Memoizable.new(item, options)
  else
    Item::Callable.new(item, options)
  end
end