Sha256: 9090023d6ce191be29bbaa3e566b768509319029e81033592e132efea358e196
Contents?: true
Size: 238 Bytes
Versions: 1
Compression:
Stored size: 238 Bytes
Contents
class Proc def throttle(sec) thread = nil Proc.new do |*args| if thread && thread.alive? thread.kill end thread = Thread.new do sleep(sec) self.call(*args) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
proc-throttle-0.0.2 | lib/proc/throttle.rb |