class Channel::Timer
Attributes
channel[R]
Public Class Methods
after(delay)
click to toggle source
# File lib/channel/timer.rb, line 14 def self.after(delay) new(delay).channel end
new(delay)
click to toggle source
# File lib/channel/timer.rb, line 4 def initialize(delay) @channel = Channel.new(1) @prc = -> { sleep delay; channel << Time.now } start end
Public Instance Methods
start()
click to toggle source
# File lib/channel/timer.rb, line 10 def start Channel::Runtime.go @prc end