diff options
Diffstat (limited to 'lib/evendoors')
-rw-r--r-- | lib/evendoors/particle.rb | 4 | ||||
-rw-r--r-- | lib/evendoors/room.rb | 17 |
2 files changed, 9 insertions, 12 deletions
diff --git a/lib/evendoors/particle.rb b/lib/evendoors/particle.rb index f532be1..f4c4ab7 100644 --- a/lib/evendoors/particle.rb +++ b/lib/evendoors/particle.rb @@ -26,8 +26,8 @@ module EvenDoors @door = o['door'] @action = o['action'] @payload = o['payload']||{} - @src = EvenDoors::Spin.spin.resolve o['src'] if o['src'] - @dst = EvenDoors::Spin.spin.resolve o['dst'] if o['dst'] + @src = EvenDoors::Spin.spin.search_down o['src'] if o['src'] + @dst = EvenDoors::Spin.spin.search_down o['dst'] if o['dst'] o['dsts'].each do |dst| add_dsts dst end if o['dsts'] set_link_fields *o['link_fields'] if o['link_fields'] o['merged'].each do |merged| merge! Particle.json_create(merged) end if o['merged'] diff --git a/lib/evendoors/room.rb b/lib/evendoors/room.rb index eaa8ace..90b824c 100644 --- a/lib/evendoors/room.rb +++ b/lib/evendoors/room.rb @@ -42,17 +42,14 @@ 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 + def search_down spath + return self if spath==path + return nil if (spath=~/^#{path}\/(\w+)\/?/)!=0 + if spot = @spots[$1] + return spot if spot.path==spath # needed as Door doesn't implement #search_down + return spot.search_down spath end - (@parent ? @parent.resolve(search) : nil ) + nil end # def try_links p |