From e8febbe183f42d9e406bdf0c92b8cd8ef6352542 Mon Sep 17 00:00:00 2001 From: mental Date: Sat, 12 Aug 2006 07:10:46 +0000 Subject: [PATCH] invariants are usually clearer up front --- share/extensions/simplepath.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/extensions/simplepath.rb b/share/extensions/simplepath.rb index 7c634fe24..466a75d10 100755 --- a/share/extensions/simplepath.rb +++ b/share/extensions/simplepath.rb @@ -78,7 +78,9 @@ def parsePath(d) lastCommand = nil lexPath(d) do |token, isCommand| - unless command + if command + raise 'Invalid number of parameters' if isCommand + else if isCommand raise 'Invalid path, must begin with moveto.' \ unless lastCommand or token.upcase == 'M' @@ -94,8 +96,6 @@ def parsePath(d) end end outputCommand = command.upcase - else - raise 'Invalid number of parameters' if isCommand end unless isCommand -- 2.30.2