Sha256: 4a6085f640099c89fe8d2a3dc57b5fa77a8d4c1efde66263d16d159790405066

Contents?: true

Size: 413 Bytes

Versions: 5

Compression:

Stored size: 413 Bytes

Contents

module Dry
  class Container
    # Container class
    #
    # @private
    class Item
      attr_reader :item, :options

      def initialize(item, options = {})
        @item = item
        @options = {
          call: item.is_a?(::Proc)
        }.merge(options)
      end

      def call
        if options[:call] == true
          item.call
        else
          item
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dry-container-0.2.3 lib/dry/container/item.rb
dry-container-0.2.2 lib/dry/container/item.rb
dry-container-0.2.1 lib/dry/container/item.rb
dry-container-0.2.0 lib/dry/container/item.rb
dry-container-0.1.0 lib/dry/container/item.rb