diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-09 13:27:36 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-09 13:27:36 +0200 |
commit | c20819d502a5e8eef1c79e130de60eefb5a9bd00 (patch) | |
tree | 67a91a14f71a281e88b24fc5245fc4b82af8b7ad | |
parent | 501dbdf8b2816aaf7c31f94fdcc01a7c1faec425 (diff) | |
download | edoors-ruby-c20819d502a5e8eef1c79e130de60eefb5a9bd00.zip edoors-ruby-c20819d502a5e8eef1c79e130de60eefb5a9bd00.tar.gz |
Spot: raise exception if @name includes PATH_SEP
-rw-r--r-- | lib/evendoors/spot.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/evendoors/spot.rb b/lib/evendoors/spot.rb index bf26761..72f5180 100644 --- a/lib/evendoors/spot.rb +++ b/lib/evendoors/spot.rb @@ -10,6 +10,7 @@ module EvenDoors @name = n # unique in it's room @parent = p # single direct parent @viewer = nil # particle going through that position will be sent there readonly + raise EvenDoors::Exception.new "Spot name #{name} is not valid" if @name.include? EvenDoors::PATH_SEP end # attr_reader :name @@ -17,8 +18,7 @@ module EvenDoors # def path return @path if @path - p = ( @parent ? @parent.path+'/' : '') + name - @path = p.sub(/^\/+/,'').sub(/\/+$/,'').gsub(/\/{2,}/,'/') + @path = ( @parent ? @parent.path+EvenDoors::PATH_SEP : '') + name end # end |