Class: Egalite::DebugLogger
Instance Method Summary collapse
-
#initialize(path) ⇒ DebugLogger
constructor
A new instance of DebugLogger.
- #puts(s) ⇒ Object
Constructor Details
#initialize(path) ⇒ DebugLogger
Returns a new instance of DebugLogger.
66 67 68 |
# File 'lib/egalite.rb', line 66 def initialize(path) @path = path end |
Instance Method Details
#puts(s) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/egalite.rb', line 69 def puts(s) open(@path, "a") { |f| begin f.flock(File::LOCK_EX) f.puts s f.flush ensure f.flock(File::LOCK_UN) end } end |