Module: Dapp::Dimg::Filelock
- Defined in:
- lib/dapp/dimg/filelock.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/dapp/dimg/filelock.rb', line 4 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#filelock(filelock, error_message: 'Already in use!', timeout: 10) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dapp/dimg/filelock.rb', line 14 def filelock(filelock, error_message: 'Already in use!', timeout: 10) return yield if self.class.filelocks[filelock] begin self.class.filelocks[filelock] = true filelock_lockfile(filelock, error_message: , timeout: timeout) do yield end ensure self.class.filelocks[filelock] = false end end |