def destroy(line) msg = { src: { }, cmd: nil, params: [ ], words: [ ] } if line[0] == ?: then src, line = line.split " ", 2 from, host = src[1..].split ?@ if not host then msg[:src][:host] = from else nick, ident = from.split ?! msg[:src] = { nick: nick, ident: ident, host: host } end end msg[:cmd], line = line.split " ", 2 until line.empty? do if line[0] == ?: then msg[:params] += [line[1..]] msg[:words], line = line[1..].split(" "), "" else param, line = line.split " ", 2 line = "" if line.nil? msg[:params] += [param] end end msg end p destroy(":irc.example.net NOTICE * :*** Looking up your hostname...")