Class: Process::Daemon::LogFile

Inherits:
File
  • Object
show all
Defined in:
lib/process/daemon/log_file.rb

Instance Method Summary collapse

Instance Method Details

#tail_logObject

Yields the lines of a log file in reverse order, once the yield statement returns true, stops, and returns the lines in order.



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/process/daemon/log_file.rb', line 25

def tail_log
	lines = []

	seek_end
	
	reverse_each_line do |line|
		lines << line
		
		break if yield line
	end

	return lines.reverse
end