Sha256: 612ee1326d286a235f7d51da0c9f7d0b2e913f1107c263f8699c4acd636e9f27

Contents?: true

Size: 610 Bytes

Versions: 2

Compression:

Stored size: 610 Bytes

Contents

module Dry
  class Container
    # Base class to abstract Memoizable and Callable implementations
    #
    # @api abstract
    #
    class Item
      # @return [Mixed] the item to be solved later
      attr_reader :item

      # @return [Hash] the options to memoize, call or no.
      attr_reader :options

      # @api abstract
      def initialize(item, options = {})
        @item = item
        @options = {
          call: item.is_a?(::Proc) && item.parameters.empty?
        }.merge(options)
      end

      # @api abstract
      def call
        raise NotImplementedError
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-container-0.7.1 lib/dry/container/item.rb
dry-container-0.7.0 lib/dry/container/item.rb