From 3c5faaea32808f060dd6c617933a60b89c561a3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 9 May 2012 13:43:22 +0200 Subject: Particle: do not accept empty destinations --- lib/evendoors/particle.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/evendoors/particle.rb b/lib/evendoors/particle.rb index 063862e..82b3983 100644 --- a/lib/evendoors/particle.rb +++ b/lib/evendoors/particle.rb @@ -45,7 +45,9 @@ module EvenDoors # def add_dsts paths paths.split(EvenDoors::LINK_SEP).each do |path| - @dsts << path.sub(/^\/+/,'').sub(/\/+$/,'').gsub(/\/{2,}/,'/').gsub(/\s+/,'') + d = path.sub(/^\/+/,'').sub(/\/+$/,'').gsub(/\/{2,}/,'/').gsub(/\s+/,'') + next if d.empty? or d==EvenDoors::ACT_SEP + @dsts << d end end # @@ -58,8 +60,7 @@ module EvenDoors # def split_dst! @dst = @room = @door = @action = nil - n = next_dst - return if n.nil? or n.empty? or n==EvenDoors::ACT_SEP + return if (n = next_dst).nil? p, @action = n.split EvenDoors::ACT_SEP i = p.rindex EvenDoors::PATH_SEP if i.nil? -- cgit v1.1-2-g2b99