X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Ftimer.rb;h=64b0ee431d4aeb261541e43bda38f31dc9953770;hb=3342d4b9a510655d320590f7333f616355d0201d;hp=aafa9be2248a8a2ad9199e45847b2fb2fb0598ec;hpb=576dd0affc6b85a8efa1f0cff0abef55ac0cd415;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/timer.rb b/lib/rbot/timer.rb index aafa9be2..64b0ee43 100644 --- a/lib/rbot/timer.rb +++ b/lib/rbot/timer.rb @@ -62,7 +62,7 @@ class Timer @repeat = opts[:repeat] if opts.include? :repeat if block_given? - @block = block + @block = block elsif opts[:code] @block = opts[:code] end @@ -214,7 +214,10 @@ class Timer end def stop - raise 'already stopped' unless @thread + unless @thread + warning 'trying to stop already stopped timer' + return + end debug "stopping timer #{self}..." @stopping = true self.synchronize { @tick.signal }