Module: Lockfile
- Defined in:
- lib/lockfile.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.ensure_no_lock_file_exists(lock_file_name) ⇒ Object
5 6 7 |
# File 'lib/lockfile.rb', line 5 def self.ensure_no_lock_file_exists(lock_file_name) FileUtils.remove_file(lock_file_name, true) end |
Instance Method Details
#with_lock_file(lock_file_path, write_pid = true) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/lockfile.rb', line 9 def with_lock_file(lock_file_path, write_pid = true) return false unless obtain_lock(lock_file_path, write_pid) begin yield ensure release_lock(lock_file_path) end end |