Sha256: 61152405c0165d48da8bf7cecb57d903b713a8806e0b59e60411f8a081c301b7
Contents?: true
Size: 481 Bytes
Versions: 9
Compression:
Stored size: 481 Bytes
Contents
module Chrono class Trigger attr_reader :block, :source def initialize(source, &block) @source = source @block = block || -> {} end def once wait call end def run loop { once } end private def call block.call end def iterator @iterator ||= Iterator.new(source) end def wait sleep(period) end def period iterator.next - Time.now + 1.second end end end
Version data entries
9 entries across 9 versions & 1 rubygems