summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-04 16:14:17 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-04 16:14:17 +0200
commit9c7ce8128ce0260c5ae312547855d3c6eb0cfac6 (patch)
tree4c8a421d100c64b5efc1be5a8fbab52c9ea08712 /lib
parent3c78b06922a8e75028fc5f8f7a2c6a87cf47bd28 (diff)
downloadedoors-ruby-9c7ce8128ce0260c5ae312547855d3c6eb0cfac6.zip
edoors-ruby-9c7ce8128ce0260c5ae312547855d3c6eb0cfac6.tar.gz
Particle: proper constructor, slimmer #reset
Diffstat (limited to 'lib')
-rw-r--r--lib/evendoors/particle.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/evendoors/particle.rb b/lib/evendoors/particle.rb
index bde56be..7bec0e4 100644
--- a/lib/evendoors/particle.rb
+++ b/lib/evendoors/particle.rb
@@ -7,10 +7,6 @@ module EvenDoors
class Particle
#
def initialize
- reset!
- end
- #
- def reset!
@ts = Time.now # creation time
@src = nil # Spot.path where it's originated from
@room = nil
@@ -24,6 +20,15 @@ module EvenDoors
@merged = [] # list of merged particles
end
#
+ def reset!
+ @ts = Time.now
+ @src = @room = @door = @action = @link_value = nil
+ @dsts.clear
+ @link_fields.clear
+ @payload.clear
+ @merged.clear
+ end
+ #
attr_accessor :src
attr_reader :ts, :room, :door, :action, :link_value, :payload
#