Class: Kraps::TempPaths

Inherits:
Object
  • Object
show all
Includes:
Enumerable, MonitorMixin
Defined in:
lib/kraps/temp_paths.rb

Instance Method Summary collapse

Constructor Details

#initializeTempPaths

Returns a new instance of TempPaths.



6
7
8
9
10
# File 'lib/kraps/temp_paths.rb', line 6

def initialize
  super

  @temp_paths = []
end

Instance Method Details

#addObject



12
13
14
15
16
17
18
# File 'lib/kraps/temp_paths.rb', line 12

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

#deleteObject



20
21
22
23
24
# File 'lib/kraps/temp_paths.rb', line 20

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

#each(&block) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/kraps/temp_paths.rb', line 26

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

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