mirror of
https://github.com/lloeki/normandy.git
synced 2025-12-06 10:04:39 +01:00
WIP
This commit is contained in:
parent
0cdf0a490a
commit
06273c3525
11 changed files with 208 additions and 29 deletions
17
lib/channel/timer.rb
Normal file
17
lib/channel/timer.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class Channel::Timer
|
||||
attr_reader :channel
|
||||
|
||||
def initialize(delay)
|
||||
@channel = Channel.new(1)
|
||||
@prc = -> { sleep delay; channel << Time.now }
|
||||
start
|
||||
end
|
||||
|
||||
def start
|
||||
Channel::Runtime.go @prc
|
||||
end
|
||||
|
||||
def self.after(delay)
|
||||
new(delay).channel
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue