class Dry::Core::Container::Item
@api abstract
Base class to abstract Memoizable and Callable implementations
def call
- Api: - abstract
def call raise ::NotImplementedError end
def callable?
- Private: -
def callable? options[:call] end
def initialize(item, options = NO_OPTIONS)
- Api: - abstract
def initialize(item, options = NO_OPTIONS) @item = item @options = { call: item.is_a?(::Proc) && item.parameters.empty?, **options } end
def map(func)
- Private: -
def map(func) if callable? self.class.new(-> { func.(item.call) }, options) else self.class.new(func.(item), options) end end
def value?
- Private: -
def value? !callable? end