Sha256: eb85d3511f2be265ee6fb3e232c2e15d74b05b4ccb81f42cddd2677de901d4e9

Contents?: true

Size: 432 Bytes

Versions: 8

Compression:

Stored size: 432 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) && item.arity == 0
        }.merge(options)
      end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dry-container-0.3.2 lib/dry/container/item.rb
dry-container-0.3.1 lib/dry/container/item.rb
dry-container-0.3.0 lib/dry/container/item.rb
dry-container-0.2.8 lib/dry/container/item.rb
dry-container-0.2.7 lib/dry/container/item.rb
dry-container-0.2.6 lib/dry/container/item.rb
dry-container-0.2.5 lib/dry/container/item.rb
dry-container-0.2.4 lib/dry/container/item.rb