lib/timers.rb in timers-1.0.2 vs lib/timers.rb in timers-1.1.0
- old
+ new
@@ -14,9 +14,19 @@
# Call the given block after the given interval
def after(interval, &block)
Timer.new(self, interval, false, &block)
end
+
+ # Call the given block after the given interval has expired. +interval+
+ # is measured in milliseconds.
+ #
+ # Timer.new.after_milliseconds(25) { puts "fired!" }
+ #
+ def after_milliseconds(interval, &block)
+ after(interval / 1000.0, &block)
+ end
+ alias_method :after_ms, :after_milliseconds
# Call the given block periodically at the given interval
def every(interval, &block)
Timer.new(self, interval, true, &block)
end