diff options
-rw-r--r-- | lib/evendoors/board.rb | 2 | ||||
-rw-r--r-- | lib/evendoors/particle.rb | 6 | ||||
-rw-r--r-- | lib/evendoors/spin.rb | 7 | ||||
-rw-r--r-- | spec/particle_spec.rb | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/lib/evendoors/board.rb b/lib/evendoors/board.rb index ba05789..90b6f00 100644 --- a/lib/evendoors/board.rb +++ b/lib/evendoors/board.rb @@ -40,7 +40,7 @@ module EvenDoors raise EvenDoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name board = self.new o['name'], o['parent'] o['postponed'].each do |link_value,particle| - board.process_p EvenDoors::Particle.json_create(particle.merge!('parent'=>board)) + board.process_p EvenDoors::Particle.json_create(particle.merge!('spin'=>board.spin)) end board end diff --git a/lib/evendoors/particle.rb b/lib/evendoors/particle.rb index 161c164..2d024fd 100644 --- a/lib/evendoors/particle.rb +++ b/lib/evendoors/particle.rb @@ -43,12 +43,12 @@ module EvenDoors @door = o['door'] @action = o['action'] @payload = o['payload']||{} - @src = o['parent'].spin.search_down o['src'] if o['src'] - @dst = o['parent'].spin.search_down o['dst'] if o['dst'] + @src = o['spin'].search_down o['src'] if o['src'] + @dst = o['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 |particle| - merge! Particle.json_create(particle.merge!('parent'=>o['parent'])) + merge! Particle.json_create(particle.merge!('spin'=>o['spin'])) end if o['merged'] end end diff --git a/lib/evendoors/spin.rb b/lib/evendoors/spin.rb index 69d204d..7fb4218 100644 --- a/lib/evendoors/spin.rb +++ b/lib/evendoors/spin.rb @@ -35,15 +35,14 @@ module EvenDoors @debug_routing = o[:debug_routing]||o['debug_routing']||false # if not o.empty? - p ={'parent'=>self} o['spots'].each do |name,spot| - EvenDoors::Room.json_create(spot.merge!(p)) + EvenDoors::Room.json_create(spot.merge!('parent'=>self)) end if o['spots'] o['app_fifo'].each do |particle| - @app_fifo << EvenDoors::Particle.json_create(particle.merge!(p)) + @app_fifo << EvenDoors::Particle.json_create(particle.merge!('spin'=>self)) end if o['app_fifo'] o['sys_fifo'].each do |particle| - @sys_fifo << EvenDoors::Particle.json_create(particle.merge!(p)) + @sys_fifo << EvenDoors::Particle.json_create(particle.merge!('spin'=>self)) end if o['sys_fifo'] end end diff --git a/spec/particle_spec.rb b/spec/particle_spec.rb index bcd8959..e96f66c 100644 --- a/spec/particle_spec.rb +++ b/spec/particle_spec.rb @@ -207,7 +207,7 @@ describe EvenDoors::Particle do p1.add_dsts 'room0/room1/door?action,output?action' p0.merge! p1 o = JSON.load( JSON.generate(p0) ) - o['parent'] = s0 + o['spin'] = s0 px = EvenDoors::Particle.json_create( o ) ((px.ts-p0.ts)<0.5).should be_true px.src.should be s3 |