Class: Pipio::HtmlLogParser
- Inherits:
-
Object
- Object
- Pipio::HtmlLogParser
- Defined in:
- lib/pipio/parsers/html_log_parser.rb
Constant Summary collapse
- TIMESTAMP_REGEX =
/\((?<timestamp>(?:\d{4}-\d{2}-\d{2} )?\d{1,2}:\d{1,2}:\d{1,2}(?: [AP]M)?)\)/
Instance Method Summary collapse
-
#initialize(source_file_path, user_aliases) ⇒ HtmlLogParser
constructor
A new instance of HtmlLogParser.
- #parse ⇒ Object
Constructor Details
#initialize(source_file_path, user_aliases) ⇒ HtmlLogParser
Returns a new instance of HtmlLogParser.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/pipio/parsers/html_log_parser.rb', line 5 def initialize(source_file_path, user_aliases) # @line_regex matches a line in an HTML log file other than the first. line_regex = /#{TIMESTAMP_REGEX} ?<b>(?<sn_or_alias>.+?) ?(?<auto_reply><AUTO-REPLY>)?:?<\/b> ?(?<body>.+)<br ?\/>/o # @line_regex_status matches a status or event line. line_regex_status = /#{TIMESTAMP_REGEX} ?<b> (?<body>.+)<\/b><br ?\/>/o cleaner = Cleaners::HtmlCleaner @parser = BasicParser.new(source_file_path, user_aliases, line_regex, line_regex_status, cleaner) end |
Instance Method Details
#parse ⇒ Object
18 19 20 |
# File 'lib/pipio/parsers/html_log_parser.rb', line 18 def parse @parser.parse end |