summaryrefslogtreecommitdiffstats
path: root/lib/evendoors/particle.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-09 15:02:54 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-09 15:02:54 +0200
commit200fa557e11cff95a8e3c3b9e136124bb8801f98 (patch)
tree67431d7e5a758073bf0693769d6c11b9466c5823 /lib/evendoors/particle.rb
parent52fc556a6925275e34ee9cd31c6e7d725e58d9a8 (diff)
downloadedoors-ruby-200fa557e11cff95a8e3c3b9e136124bb8801f98.zip
edoors-ruby-200fa557e11cff95a8e3c3b9e136124bb8801f98.tar.gz
Particle: add_dsts raise Exception on malformed dst
Diffstat (limited to 'lib/evendoors/particle.rb')
-rw-r--r--lib/evendoors/particle.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/evendoors/particle.rb b/lib/evendoors/particle.rb
index 82b3983..111ce9a 100644
--- a/lib/evendoors/particle.rb
+++ b/lib/evendoors/particle.rb
@@ -43,18 +43,19 @@ module EvenDoors
@dsts.clear
end
#
- def add_dsts paths
- paths.split(EvenDoors::LINK_SEP).each do |path|
- d = path.sub(/^\/+/,'').sub(/\/+$/,'').gsub(/\/{2,}/,'/').gsub(/\s+/,'')
- next if d.empty? or d==EvenDoors::ACT_SEP
- @dsts << d
+ def add_dsts dsts
+ dsts.split(EvenDoors::LINK_SEP).each do |dst|
+ if dst.empty? or dst[0]==EvenDoors::PATH_SEP or dst[0]==EvenDoors::PATH_SEP or dst=~/\/\?/\
+ or dst=~/\/{2,}/ or dst=~/\s+/ or dst==EvenDoors::ACT_SEP
+ raise EvenDoors::Exception.new "destination #{dst} is not acceptable"
+ end
+ @dsts << dst
end
end
#
def set_dst! a, d=''
@dst = @room = @door = @action = nil
clear_dsts!
- return if ( (a.nil? or a.empty?) and d.empty? )
add_dsts d+EvenDoors::ACT_SEP+a
end
#