summaryrefslogtreecommitdiffstats
path: root/lib/evendoors/spot.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-09 13:27:36 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-09 13:27:36 +0200
commitc20819d502a5e8eef1c79e130de60eefb5a9bd00 (patch)
tree67a91a14f71a281e88b24fc5245fc4b82af8b7ad /lib/evendoors/spot.rb
parent501dbdf8b2816aaf7c31f94fdcc01a7c1faec425 (diff)
downloadedoors-ruby-c20819d502a5e8eef1c79e130de60eefb5a9bd00.zip
edoors-ruby-c20819d502a5e8eef1c79e130de60eefb5a9bd00.tar.gz
Spot: raise exception if @name includes PATH_SEP
Diffstat (limited to 'lib/evendoors/spot.rb')
-rw-r--r--lib/evendoors/spot.rb4
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