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 = {})

Other tags:
    Api: - abstract
def initialize(item, options = {})
  @item = item
  @options = {
    call: item.is_a?(::Proc) && item.parameters.empty?
  }.merge(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