[rspec-users] specs on private methods

Rick DeNatale rick.denatale at gmail.com
Wed Jan 9 12:01:54 EST 2008

On Jan 8, 2008 3:56 PM, Francois Wurmus <francois.wurmus at infopark.de> wrote:
> Chris Olsen schrieb:
> > Will obj.send(:method) work in 1.9 or is it saying that the send call
> > requires 2 params, the method and the object reference?
> >
> obj.send(:method) will work for non-private methods and send! works for
> private methods.

I'm pretty sure that Matz backed this difference out between 1.8 and
1.9, he took out some of these things before the Christmas release of

Object#send will work for private methods as it always did, and
Object#send! is no longer there.

> additionally there is send() without a receiving object. that is the
> only of those methods requiring two parameters.

There's no such thing as a method call without a receiving object in Ruby


is the same as


Object#send takes an arbitrary number of arguments, the first argument
is the method selector, the rest are used as arguments to the method
being called.

Rick DeNatale

My blog on Ruby

More information about the rspec-users mailing list