Class: RSCM::AbstractLogParser
- Inherits:
-
Object
- Object
- RSCM::AbstractLogParser
- Defined in:
- lib/rscm/abstract_log_parser.rb
Overview
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
Direct Known Subclasses
Instance Method Summary collapse
- #convert_all_slashes_to_forward_slashes(file) ⇒ Object
-
#initialize(io) ⇒ AbstractLogParser
constructor
A new instance of AbstractLogParser.
- #read_until_matching_line(regexp) ⇒ Object
Constructor Details
#initialize(io) ⇒ AbstractLogParser
Returns a new instance of AbstractLogParser.
10 11 12 |
# File 'lib/rscm/abstract_log_parser.rb', line 10 def initialize(io) @io = io end |
Instance Method Details
#convert_all_slashes_to_forward_slashes(file) ⇒ Object
29 30 31 |
# 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) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# 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 |