aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/utils
diff options
context:
space:
mode:
authorMarkus Reiter2016-09-24 13:52:43 +0200
committerMarkus Reiter2016-09-24 16:00:58 +0200
commitb86c8efb79b3ed835d552c4d7416640ef10caf21 (patch)
tree7e1edc8a8f339e4d2781f43576d40c9c79aebcdc /Library/Homebrew/cask/lib/hbc/utils
parent687f0fcf721c8e36f32570ed72d0988a6eaf986f (diff)
downloadbrew-b86c8efb79b3ed835d552c4d7416640ef10caf21.tar.bz2
Cask: Use nested classes and modules.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/utils')
-rw-r--r--Library/Homebrew/cask/lib/hbc/utils/file.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/utils/file.rb b/Library/Homebrew/cask/lib/hbc/utils/file.rb
index 967c6834f..6b80f33ce 100644
--- a/Library/Homebrew/cask/lib/hbc/utils/file.rb
+++ b/Library/Homebrew/cask/lib/hbc/utils/file.rb
@@ -1,12 +1,14 @@
-module Hbc::Utils
- module_function
+module Hbc
+ module Utils
+ module_function
- def file_locked?(file)
- unlocked = File.open(file).flock(File::LOCK_EX | File::LOCK_NB)
- # revert lock if file was unlocked before check
- File.open(file).flock(File::LOCK_UN) if unlocked
- !unlocked
- rescue
- true
+ def file_locked?(file)
+ unlocked = File.open(file).flock(File::LOCK_EX | File::LOCK_NB)
+ # revert lock if file was unlocked before check
+ File.open(file).flock(File::LOCK_UN) if unlocked
+ !unlocked
+ rescue
+ true
+ end
end
end