summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-09 13:43:22 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-09 13:43:22 +0200
commit3c5faaea32808f060dd6c617933a60b89c561a3d (patch)
tree84bf822e9ed313f5e5d134f481d3ccc6d9342b18
parent865a67bf6b4313bda71f7689acc1ccae088c7c77 (diff)
downloadedoors-ruby-3c5faaea32808f060dd6c617933a60b89c561a3d.zip
edoors-ruby-3c5faaea32808f060dd6c617933a60b89c561a3d.tar.gz
Particle: do not accept empty destinations
-rw-r--r--lib/evendoors/particle.rb7
1 files 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?