Module: Merritt::TIND::Files
- Defined in:
- lib/merritt/tind/files.rb
Constant Summary collapse
- DEFAULT_TIMEOUT_SECS =
5
- DEFAULT_SLEEP_INTERVAL_SECS =
0.1
Class Method Summary collapse
Class Method Details
.rotate_and_lock(filename) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/merritt/tind/files.rb', line 18 def rotate_and_lock(filename) with_lock(filename) do |f| if File.size?(filename) rotating(filename) { |f1| yield f1 } else yield f end end end |
.with_lock(filename) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/merritt/tind/files.rb', line 11 def with_lock(filename) f = acquire_lock(filename) yield f ensure f.flock(File::LOCK_UN) if f end |