class RSCM::AbstractLogParser
NOTE: It is recommended to use the Parser class in parser.rb as a basis for new SCM parsers
Some utilities for log-parsers TODO: make this a module and remove the attr_reader
Public Class Methods
new(io)
click to toggle source
# File lib/rscm/abstract_log_parser.rb, line 10 def initialize(io) @io = io end
Public Instance Methods
convert_all_slashes_to_forward_slashes(file)
click to toggle source
# File lib/rscm/abstract_log_parser.rb, line 29 def convert_all_slashes_to_forward_slashes(file) file.gsub(/\/, "/") end
read_until_matching_line(regexp)
click to toggle source
# File lib/rscm/abstract_log_parser.rb, line 14 def read_until_matching_line(regexp) return nil if @io.eof? result = "" @io.each_line do |line| line.gsub!(/\r\n$/, "\n") break if line =~ regexp result << line end if result.strip == "" read_until_matching_line(regexp) else result end end