Module: Super::Tailer

Extended by:
Tailer
Included in:
Tailer
Defined in:
lib/super/tailer.rb,
lib/super/tailer/version.rb

Constant Summary collapse

VERSION =
"0.0.3"

Instance Method Summary collapse

Instance Method Details

#watch(content_file) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/super/tailer.rb', line 7

def watch(content_file)
  file = File.new(content_file)
  file.seek(0, File::SEEK_END)

  loop do
    begin
      yield file.readline
    rescue EOFError
      file.seek(0, File::SEEK_CUR)
      sleep 0.1
    end
  end
end