From: Chris White Date: 2011-08-01T03:00:36+09:00 Subject: Re: send() docs are wrong On Jul 31, 2011, at 10:51 AM, 7stud -- wrote: > obj.send(symbol [, args...]) → obj > obj.__send__(symbol [, args...]) → obj > > Somehow, I don't expect the return value of send() to be the receiver. > Let's test send()'s return value using the example provided: > > class Klass > def hello(*args) > "Hello " + args.join(' ') > end > end > > k = Klass.new > x = k.send :hello, "gentle", "readers" > > puts x.class > > --output:-- > String > > According to the docs, the return value of send() should be k, the > receiver, and k.class would therefore output: Klass. Potentially misleading yes, incorrect no. If you call send on an object you get an object back. It may be the same object, it may be another object. You could say obj.send(symbol [, args...]) → otherobj Which would work for your case, but not if the object itself was returned. Take for example: class Klass def test self end end k = Klass.new puts (k.send :test).class --output:-- Klass Regards, Chris White Twitter: http://www.twitter.com/cwgem