# File lib/net/yail/message_parser.rb, line 38 def initialize(line) @params = [] if line =~ MESSAGE matches = Regexp.last_match @prefix = matches[1] if (matches[2]) @nick = matches[2] @user = matches[3] @host = matches[4] else @servername = matches[1] end @command = matches[5] # Args are a bit tricky. First off, we know there must be a single # space before the arglist, so we need to strip that. Then we have to # separate the trailing arg as it can contain nearly any character. And # finally, we split the "middle" args on space. arglist = matches[6].sub(/^ +/, '') (middle_args, trailing_arg) = arglist.split(/ *:/, 2) @params.push(middle_args.split(/ +/), trailing_arg) @params.flatten! end end