Class: Suspect::FileUtils::FlockWriter
- Inherits:
-
Object
- Object
- Suspect::FileUtils::FlockWriter
- Defined in:
- lib/suspect/file_utils/flock_writer.rb
Constant Summary collapse
- PERMISSIONS =
0644- MODE =
'a'
Instance Method Summary collapse
Instance Method Details
#write(path, content) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/suspect/file_utils/flock_writer.rb', line 8 def write(path, content) File.open path, MODE, PERMISSIONS do |f| f.flock File::LOCK_EX f.write "#{content}\n" f.flush end end |