Class: Jekyll::RpLogs::IrssiXChatParser
- Defined in:
- lib/jekyll/rp_logs/parsers/irssi_xchat.rb
Constant Summary collapse
- FORMAT_STR =
Add this class to the parsing dictionary
"irssi-xchat"
- DATE_REGEXP =
/(?<timestamp>\d\d:\d\d)/
- TIMESTAMP_FORMAT =
"%H:%M"
- MSG =
/(?<msg>[^\n]*)/
- JUNK =
TODO: Update to match join/part/quit format
/#{DATE_REGEXP}\t<?-->?\t.*$/
- EMOTE =
/^#{FLAGS}#{DATE_REGEXP} {16}\* \| #{NICK}\s+#{MSG}$/
- TEXT =
/^#{FLAGS}#{DATE_REGEXP} <#{MODE}? *#{NICK}> \| #{MSG}$/
Constants inherited from Parser
Parser::FLAGS, Parser::MODE, Parser::NICK
Class Method Summary collapse
Class Method Details
.parse_line(line, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/jekyll/rp_logs/parsers/irssi_xchat.rb', line 18 def self.parse_line(line, = {}) case line when JUNK return nil when EMOTE type = :rp when TEXT type = :ooc mode = $LAST_MATCH_INFO[:mode] mode = " " if mode == "" else # Only put text and emotes in the log return nil end date = DateTime.strptime($LAST_MATCH_INFO[:timestamp], TIMESTAMP_FORMAT) LogLine.new( date, , sender: $LAST_MATCH_INFO[:nick], contents: $LAST_MATCH_INFO[:msg], flags: $LAST_MATCH_INFO[:flags], type: type, mode: mode ) end |