lib/rscm/abstract_log_parser.rb in rscm-0.3.14 vs lib/rscm/abstract_log_parser.rb in rscm-0.3.15
- old
+ new
@@ -5,26 +5,21 @@
#
# Some utilities for log-parsers
# TODO: make this a module and remove the attr_reader
class AbstractLogParser
- attr_reader :io
-
def initialize(io)
@io = io
- @current_line_number = 0
- @had_error = false
end
def read_until_matching_line(regexp)
- return nil if io.eof?
+ return nil if @io.eof?
result = ""
- io.each_line do |line|
- @current_line_number += 1
+ @io.each_line do |line|
line.gsub!(/\r\n$/, "\n")
- break if line=~regexp
- result<<line
+ break if line =~ regexp
+ result << line
end
if result.strip == ""
read_until_matching_line(regexp)
else
result
@@ -33,17 +28,8 @@
def convert_all_slashes_to_forward_slashes(file)
file.gsub(/\\/, "/")
end
- def error(msg)
- @had_error=true
- $stderr.puts(msg + "\ncurrent line: #{@current_line}\nstack trace:\n")
- $stderr.puts(caller.backtrace.join('\n\t'))
- end
-
- def had_error?
- @had_error
- end
end
end
\ No newline at end of file