From 9c7ce8128ce0260c5ae312547855d3c6eb0cfac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 4 May 2012 16:14:17 +0200 Subject: Particle: proper constructor, slimmer #reset --- lib/evendoors/particle.rb | 13 +++++++++---- 1 file 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 # -- cgit v1.1-2-g2b99