lib/marvin/parsers/simple_parser.rb in Sutto-marvin-0.4.0 vs lib/marvin/parsers/simple_parser.rb in Sutto-marvin-0.8.0.0
- old
+ new
@@ -5,20 +5,15 @@
private
# Parses an incoming message by using string
# Manipulation.
def self.parse!(line)
- if line[0] == ?:
- prefix_text, line = line.split(" ", 2)
- else
- prefix_text = nil
- end
- command = Marvin::Parsers::Command.new(line + "\r\n")
+ prefix_text = nil
+ prefix_text, line = line.split(" ", 2) if line[0] == ?:
+ command = Command.new("#{line}\r\n")
command.prefix = self.extract_prefix(prefix_text)
- head, tail = line.split(":", 2)
- parts = head.split(" ")
+ parts = Marvin::Util.arguments(line)
command.code = parts.shift
- parts << tail unless tail.nil?
command.params = parts
return command
end
# From a given string, attempts to get the correct
\ No newline at end of file