Like many others, I saw the exception
private method 'select' called for nil:NilClass (NoMethodError)
go by. What struck me as odd is that it didn't say undefined method 'select' for nil:NilClass (NoMethodError)
. There was indeed such a method, and it was private!
What is this method?
I've found that it's defined on Object
, and not just NilClass
, but it's not defined on BasicObject
. By using #send
, I've found that it takes 1..4 arguments. The first three must be an array (or nil). And the last one must be convertible to a "time interval". In any case, when it doesn't throw an argument error, it hangs.
It's not in the ruby documentation because it's private. I don't really know how to read the C source code, and I haven't been able to find anything suggestive there. I expected to see something like the following line in object.c
;
rb_define_private_method(rb_cObject, "select", select, 0);
But alas, I cannot.
What is this method?