Sha256: 41f7d40bc32fb95fa1d64da2afb494d874c58297a86f47fc069707ab29f70720

Contents?: true

Size: 528 Bytes

Versions: 5

Compression:

Stored size: 528 Bytes

Contents

module Kraps
  class TempPaths
    include MonitorMixin
    include Enumerable

    def initialize
      super

      @temp_paths = []
    end

    def add
      synchronize do
        temp_path = TempPath.new
        @temp_paths << temp_path
        temp_path
      end
    end

    def delete
      synchronize do
        @temp_paths.each(&:delete)
      end
    end

    def each(&block)
      return enum_for(__method__) unless block_given?

      synchronize do
        @temp_paths.each(&block)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kraps-0.10.0 lib/kraps/temp_paths.rb
kraps-0.9.0 lib/kraps/temp_paths.rb
kraps-0.8.0 lib/kraps/temp_paths.rb
kraps-0.7.0 lib/kraps/temp_paths.rb
kraps-0.6.0 lib/kraps/temp_paths.rb