Skip to content

Instantly share code, notes, and snippets.

@repeatedly
Created November 19, 2017 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save repeatedly/35c4d438289a823e76b0a2732eec2316 to your computer and use it in GitHub Desktop.
Save repeatedly/35c4d438289a823e76b0a2732eec2316 to your computer and use it in GitHub Desktop.
Cool.io Timer result between 2.4 and 2.5

2.5.0-dev

% ruby --version
ruby 2.5.0dev (2017-11-18 trunk 60833) [x86_64-darwin15]

% ruby timer_test.rb
Traceback (most recent call last):
        3: from t_test.rb:16:in `<main>'
        2: from /Users/repeatedly/.rbenv/versions/2.5.0-dev/lib/ruby/gems/2.5.0/gems/cool.io-1.5.1/lib/cool.io/loop.rb:88:in `run'
        1: from /Users/repeatedly/.rbenv/versions/2.5.0-dev/lib/ruby/gems/2.5.0/gems/cool.io-1.5.1/lib/cool.io/loop.rb:88:in `run_once'
t_test.rb:8:in `on_timer': wrong number of arguments (given 8, expected 0) (ArgumentError)

2.4.2

% ruby --version
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]

% ruby timer_test.rb
:foo
:foo
:foo
...
require 'cool.io'
class MyTimerWatcher < Cool.io::TimerWatcher
def initialize
super(1.0, true)
end
def on_timer
p :foo
end
end
loop = Coolio::Loop.new
timer = MyTimerWatcher.new
loop.attach(timer)
loop.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment