diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-09 13:43:22 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-09 13:43:22 +0200 |
commit | 3c5faaea32808f060dd6c617933a60b89c561a3d (patch) | |
tree | 84bf822e9ed313f5e5d134f481d3ccc6d9342b18 /lib/evendoors | |
parent | 865a67bf6b4313bda71f7689acc1ccae088c7c77 (diff) | |
download | edoors-ruby-3c5faaea32808f060dd6c617933a60b89c561a3d.zip edoors-ruby-3c5faaea32808f060dd6c617933a60b89c561a3d.tar.gz |
Particle: do not accept empty destinations
Diffstat (limited to 'lib/evendoors')
-rw-r--r-- | lib/evendoors/particle.rb | 7 |
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? |