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

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/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::Container::Item::Base

Creates an Item Memoizable or Callable

Parameters:

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

Returns:

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

Raises:



20
21
22
# File 'lib/dry/container/item/factory.rb', line 20

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