summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-11 11:48:21 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-12 09:38:01 +0200
commite0ec845f5818f006c65a639dd62b49205fd703ae (patch)
treef364005f9d1e520e6bcc352586210c1630fa4085
parentd2855043c53bd4f84a4ca425947948fd31a93432 (diff)
downloadedoors-ruby-e0ec845f5818f006c65a639dd62b49205fd703ae.zip
edoors-ruby-e0ec845f5818f006c65a639dd62b49205fd703ae.tar.gz
Room,Door: use @spin instead of spin accessor
-rw-r--r--lib/evendoors/door.rb8
-rw-r--r--lib/evendoors/room.rb26
2 files changed, 17 insertions, 17 deletions
diff --git a/lib/evendoors/door.rb b/lib/evendoors/door.rb
index 0729adf..4bc1465 100644
--- a/lib/evendoors/door.rb
+++ b/lib/evendoors/door.rb
@@ -41,18 +41,18 @@ module EvenDoors
end
#
def require_p p_kls
- p = spin.require_p p_kls
+ p = @spin.require_p p_kls
p.src = self
p
end
#
def release_p p
@saved=nil if @saved==p # particle is released, all is good
- spin.release_p p
+ @spin.release_p p
end
#
def garbage
- puts " * #{path} didn't give back #{p}" if spin.debug_errors
+ puts " * #{path} didn't give back #{p}" if @spin.debug_errors
puts "\t#{@saved.data EvenDoors::ERROR_FIELD}" if @saved.action==EvenDoors::ACT_ERROR
release_p @saved
@saved = nil
@@ -67,7 +67,7 @@ module EvenDoors
#
def process_sys_p p
# nothing todo with it now
- spin.release_p p
+ @spin.release_p p
end
#
def send_p p
diff --git a/lib/evendoors/room.rb b/lib/evendoors/room.rb
index b7f6844..aa1e7d1 100644
--- a/lib/evendoors/room.rb
+++ b/lib/evendoors/room.rb
@@ -66,12 +66,12 @@ module EvenDoors
end
#
def start!
- puts " * start #{path}" if spin.debug_routing
+ puts " * start #{path}" if @spin.debug_routing
@spots.values.each do |spot| spot.start! if spot.respond_to? :start! end
end
#
def stop!
- puts " * stop #{path}" if spin.debug_routing
+ puts " * stop #{path}" if @spin.debug_routing
@spots.values.each do |spot| spot.stop! if spot.respond_to? :stop! end
end
#
@@ -86,7 +86,7 @@ module EvenDoors
end
#
def try_links p
- puts " -> try_links ..." if spin.debug_routing
+ puts " -> try_links ..." if @spin.debug_routing
links = @links[p.src.name]
return false if links.nil?
pending_link = nil
@@ -97,7 +97,7 @@ module EvenDoors
if apply_link or (p.link_value==link.cond_value)
# link matches !
if pending_link
- p2 = spin.require_p p.class
+ p2 = @spin.require_p p.class
p2.clone_data p
p2.apply_link! link
send_p p2
@@ -130,10 +130,10 @@ module EvenDoors
end
#
def send_p p
- puts " * send_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if spin.debug_routing
+ puts " * send_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if @spin.debug_routing
if p.src.nil?
# do not route orphan particles !!
- p.error! EvenDoors::ERROR_ROUTE_NS, spin
+ p.error! EvenDoors::ERROR_ROUTE_NS, @spin
elsif p.next_dst
p.split_dst!
if p.door
@@ -147,31 +147,31 @@ module EvenDoors
else
p.error! EvenDoors::ERROR_ROUTE_NDNL
end
- puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if spin.debug_routing
- spin.send_p p
+ puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if @spin.debug_routing
+ @spin.send_p p
end
#
def send_sys_p p
- puts " * send_sys_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if spin.debug_routing
+ puts " * send_sys_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if @spin.debug_routing
if p.next_dst
p.split_dst!
if p.door
route_p p
elsif p.action
- p.dst_routed! spin
+ p.dst_routed! @spin
end
else
p.error! EvenDoors::ERROR_ROUTE_SND
end
- puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if spin.debug_routing
- spin.send_sys_p p
+ puts " -> #{p.dst.path}#{EvenDoors::ACT_SEP}#{p.action}" if @spin.debug_routing
+ @spin.send_sys_p p
end
#
def process_sys_p p
if p.action==EvenDoors::SYS_ACT_ADD_LINK
add_link EvenDoors::Link.from_particle_data p
end
- spin.release_p p
+ @spin.release_p p
end
#
end