splattael/libnotify — Issue #15: Strange libnotify (potentially ruby/autoload) bug
Author: nuisanceofcats
Created: 2012-01-11 12:37:42+00:00
State: open

In my project catfriend I have to add the following line after the require for libnotify:

```ruby
require 'libnotify'

module Libnotify
class API ; end
end
```

Without that I get the following error 90% of the time (90%... wtf you're probably thinking just as I am):

```
unknown error wrong number of arguments(1 for 0)
/usr/lib/ruby/gems/1.9.1/gems/libnotify-0.7.1/lib/libnotify.rb:56:in `initialize'
/usr/lib/ruby/gems/1.9.1/gems/libnotify-0.7.1/lib/libnotify.rb:56:in `new'
/usr/lib/ruby/gems/1.9.1/gems/libnotify-0.7.1/lib/libnotify.rb:56:in `new'
/home/james/projects/catfriend/lib/catfriend/imap.rb:59:in `run'
/home/james/projects/catfriend/lib/catfriend/thread.rb:6:in `block in start'
```

I don't re-open Libnotify at all. It makes no sense because the autoload through API clearly gives an initialize that takes 0-2 arguments.

Now trying to break this down to a small test case by just calling Libnotify.new with the same simple arguments I am works fine. Maybe a combination with the threading?

Hope I've made a glaring error here.