Class: Jekyll::RpLogs::Skype24Parser
- Defined in:
- lib/jekyll/rp_logs/parse_skype_24hour.rb
Overview
This is for the date format [05.06.15 10:58:47]
Constant Summary collapse
- FORMAT_STR =
Add this class to the parsing dictionary
"Skype24"- NICK =
/(?<nick>[\w\-\\\[\]\{\}\^\`\|\s\']+)/- DATE_REGEXP =
/(?<timestamp>\[\d\d.\d\d.\d\d\s\d\d\:\d\d\:\d\d\])/- TIMESTAMP_FORMAT =
"[%d.%m.%y %H:%M:%S]"- MSG =
/(?<msg>[^\n]*)/- BAD_STUFF =
/[^a-zA-Z\-\_]/- EMOTE =
/^#{FLAGS}#{DATE_REGEXP}\s#{NICK}:\s\k<nick>#{MSG}$/- TEXT =
/^#{FLAGS}#{DATE_REGEXP}\s#{NICK}:\s#{MSG}$/
Constants inherited from Parser
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 |
# File 'lib/jekyll/rp_logs/parse_skype_24hour.rb', line 18 def self.parse_line(line, = {}) case line when EMOTE type = :rp when TEXT type = :ooc else # Only put text and emotes in the log return nil end # Preserve all the matches before the gsub date = DateTime.strptime($LAST_MATCH_INFO[:timestamp], TIMESTAMP_FORMAT) contents = $LAST_MATCH_INFO[:msg] flags = $LAST_MATCH_INFO[:flags] sendername = $LAST_MATCH_INFO[:nick].tr(" ", "-").gsub(BAD_STUFF, "") LogLine.new( date, , sender: sendername, contents: contents, flags: flags, type: type ) end |