X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Ftimer.rb;h=bebe41f2fd589ba2fd9ccd41db8d354eb7dde0f2;hb=c986bc82f4b856818e97e24fbf5fc11eef5f25c2;hp=c87c9c4db80aad98b1b123a0f19e028950b8592c;hpb=a9b32eae21a10254f67653c8ce92076300ba670b;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/timer.rb b/lib/rbot/timer.rb index c87c9c4d..bebe41f2 100644 --- a/lib/rbot/timer.rb +++ b/lib/rbot/timer.rb @@ -117,17 +117,21 @@ module Timer # block action with handle +handle+ def block(handle) + raise "no such timer #{handle}" unless @timers[handle] @timers[handle].blocked = true end # unblock action with handle +handle+ def unblock(handle) + raise "no such timer #{handle}" unless @timers[handle] @timers[handle].blocked = false end # reschedule action with handle +handle+ to change its period def reschedule(handle, period) + raise "no such timer #{handle}" unless @timers[handle] @timers[handle].reschedule(period) + tick end # you can call this when you know you're idle, or you can split off a