Sha256: 6f01f30fc97629ee368a09eef428538b5a7576b5ac586d583df7cf2dade6b955
Contents?: true
Size: 413 Bytes
Versions: 10
Compression:
Stored size: 413 Bytes
Contents
#!/usr/bin/env ruby $:.unshift File.expand_path '../lib', File.dirname(__FILE__) require 'event_emitter' class Timer include EventEmitter def start(sec, count) count.times do sleep sec emit :tick end emit :end end end timer = Timer.new timer.on :tick do puts Time.now end timer.once :tick do puts "timer start" end timer.on :end do puts "timer end" end timer.start 1, 5
Version data entries
10 entries across 10 versions & 2 rubygems