class Dry::Core::Container::Item


@api abstract
Base class to abstract Memoizable and Callable implementations

def call

Other tags:
    Api: - abstract
def call
  raise ::NotImplementedError
end

def callable?

Other tags:
    Private: -
def callable?
  options[:call]
end

def initialize(item, options = NO_OPTIONS)

Other tags:
    Api: - abstract
def initialize(item, options = NO_OPTIONS)
  @item = item
  @options = {
    call: item.is_a?(::Proc) && item.parameters.empty?,
    **options
  }
end

def map(func)

Other tags:
    Private: -
def map(func)
  if callable?
    self.class.new(-> { func.(item.call) }, options)
  else
    self.class.new(func.(item), options)
  end
end

def value?

Other tags:
    Private: -
def value?
  !callable?
end