Class: Txray::Tail

Inherits:
Object
  • Object
show all
Defined in:
lib/txray/tail.rb

Constant Summary collapse

INTERVAL =
0.15

Instance Method Summary collapse

Constructor Details

#initialize(path, from_start: false) ⇒ Tail

Returns a new instance of Tail.



7
8
9
10
# File 'lib/txray/tail.rb', line 7

def initialize(path, from_start: false)
  @path = path
  @skip_existing = !from_start && File.exist?(path)
end

Instance Method Details

#each_batchObject



12
13
14
15
16
17
# File 'lib/txray/tail.rb', line 12

def each_batch
  loop do
    yield read
    sleep INTERVAL
  end
end