Sha256: 8ea766ac49739343d46b97952483d3792a903e43df564daadf7b4df7ed200ce7

Contents?: true

Size: 462 Bytes

Versions: 2

Compression:

Stored size: 462 Bytes

Contents

require 'dry/container/item'

module Dry
  class Container
    class Item
      # Callable class to returns a item call
      #
      # @api public
      #
      class Callable < Item
        # Returns the result of item call or item
        #
        # @return [Mixed]
        def call
          callable? ? item.call : item
        end

        private

        # @private
        def callable?
          options[:call]
        end
      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/callable.rb
dry-container-0.7.0 lib/dry/container/item/callable.rb