Class: Kraps::TempPaths
- Inherits:
-
Object
- Object
- Kraps::TempPaths
- Includes:
- Enumerable, MonitorMixin
- Defined in:
- lib/kraps/temp_paths.rb
Instance Method Summary collapse
- #add ⇒ Object
- #delete ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ TempPaths
constructor
A new instance of TempPaths.
Constructor Details
#initialize ⇒ TempPaths
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
#add ⇒ Object
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 |
#delete ⇒ Object
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 |