diff options
author | Curtis Cablegram <cablegram@comcast.net> | 2010-07-28 19:47:53 -0500 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-08-03 10:50:25 +0200 |
commit | e1142dfcae036bd8c6400962f9e07112b750b730 (patch) | |
tree | 39343b4ed33a55af87b5020fa1bcb8a17bf90ce9 /railties/lib/rails/rack/log_tailer.rb | |
parent | 1466f312bad35809fa9fe343068d2fc8a814ffe6 (diff) | |
download | rails-e1142dfcae036bd8c6400962f9e07112b750b730.tar.gz rails-e1142dfcae036bd8c6400962f9e07112b750b730.tar.bz2 rails-e1142dfcae036bd8c6400962f9e07112b750b730.zip |
Refactor log-tailer to depend on File#eof? rather than File#mtime
[#5220 state:resolved]
Eliminate 1 instance variable and 1 local variable.
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'railties/lib/rails/rack/log_tailer.rb')
-rw-r--r-- | railties/lib/rails/rack/log_tailer.rb | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/railties/lib/rails/rack/log_tailer.rb b/railties/lib/rails/rack/log_tailer.rb index 2ca6b5f8da..011ac6cecc 100644 --- a/railties/lib/rails/rack/log_tailer.rb +++ b/railties/lib/rails/rack/log_tailer.rb @@ -6,7 +6,6 @@ module Rails path = Pathname.new(log || "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log").cleanpath @cursor = ::File.size(path) - @last_checked = Time.now.to_f @file = ::File.open(path, 'r') end @@ -20,10 +19,8 @@ module Rails def tail! @file.seek @cursor - mod = @file.mtime.to_f - if mod > @last_checked + if !@file.eof? contents = @file.read - @last_checked = mod @cursor = @file.tell $stdout.print contents end |