summaryrefslogtreecommitdiffstats
path: root/lib/iotas/particle.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-06-03 10:18:12 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-06-03 10:18:12 +0200
commit6e400f6016a8e335c8482a8ae1802c4a76662892 (patch)
tree1ae040e59456c8ce42b275b82b02823e95f53a2f /lib/iotas/particle.rb
parentd15d685884db41c7480f30c201d7303de8c55788 (diff)
downloadedoors-ruby-6e400f6016a8e335c8482a8ae1802c4a76662892.zip
edoors-ruby-6e400f6016a8e335c8482a8ae1802c4a76662892.tar.gz
simplify Particle@dst life cycle
Partilce#dst_reached! is removed Particle#init! set @dst=nil Door#send_ calls Particle#set_dst if parameters are provided
Diffstat (limited to 'lib/iotas/particle.rb')
-rw-r--r--lib/iotas/particle.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/iotas/particle.rb b/lib/iotas/particle.rb
index 78975bf..295d505 100644
--- a/lib/iotas/particle.rb
+++ b/lib/iotas/particle.rb
@@ -75,6 +75,7 @@ module Iotas
self.new o
end
#
+ # called when released
def reset!
@ts = @src = @dst = @room = @door = @action = @link_value = nil
@dsts.clear
@@ -83,7 +84,9 @@ module Iotas
@merged.clear
end
#
+ # called when sent
def init! src
+ @dst = nil
@src = src
@ts = Time.now
end
@@ -140,12 +143,6 @@ module Iotas
@dsts.shift
end
#
- def dst_reached!
- d = @dst
- @dst = nil
- d
- end
- #
def error! e, dst=nil
@action = Iotas::ACT_ERROR
@dst = dst||@src