diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-10 17:22:36 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-10 17:22:36 +0200 |
commit | d916c197fd06eb5f818e2bd75d5d1312c4758975 (patch) | |
tree | 802d8994c2bfb0bc9390e1e5785bf436db44c9f3 /lib | |
parent | 36ace535fee16efe81f17b871979f51845fb1270 (diff) | |
download | edoors-ruby-d916c197fd06eb5f818e2bd75d5d1312c4758975.zip edoors-ruby-d916c197fd06eb5f818e2bd75d5d1312c4758975.tar.gz |
Room: implement resolve
Diffstat (limited to 'lib')
-rw-r--r-- | lib/evendoors/room.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/evendoors/room.rb b/lib/evendoors/room.rb index d06c00f..eaa8ace 100644 --- a/lib/evendoors/room.rb +++ b/lib/evendoors/room.rb @@ -42,6 +42,19 @@ module EvenDoors @spin = ( @parent.nil? ? self : @parent.spin ) end # + def resolve search + return self if search==path + if (search=~/^#{path}\/(\w+)\/?/)==0 + if spot = @spots[$1] + return spot if spot.path==search # needed as Door doesn't implement #resolve + return spot.resolve search + else + nil + end + end + (@parent ? @parent.resolve(search) : nil ) + end + # def try_links p puts " -> try_links ..." if EvenDoors::Spin.debug_routing links = @links[p.src.name] |