Hi --

On Fri, 17 Jul 2009, Wes Gamble wrote:

>
> All,
>
> It appears that Rails adds the send! method to Object, via the output
> below.
>
> gandalf-2:royaltyzone weyus$ irb
>>> Object.methods.include?("send!")
> => false
>>> exit
> gandalf-2:royaltyzone weyus$ script/console
> Loading development environment (Rails 2.1.2)
>>> Object.methods.include?("send!")
> => true
>>> exit
>
> I assume this is to provide backward compatibility with the new send!
> method in Ruby 1.9 that allows you to still dynamically call private
> methods?  Is this correct?

There's no send! in 1.9. I wish there were; I like send/send!  more
than public_send/send, and I think Matz put it in there briefly but
then decided that switching the sense of send was too
backwards-incompatible. Also there was some question which was the
"dangerous" one: the one that included private methods, or the one
that didn't.

It appears to be gone from Rails, so maybe it was only there during
the brief period that it was in 1.9.

$ ./script/console 
Loading development environment (Rails 2.3.2)
>> Object.new.send!
NoMethodError: undefined method `send!' for #<Object:0x2378780>
        from (irb):6


David

-- 
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Now available: The Well-Grounded Rubyist (http://manning.com/black2)
Training! Intro to Ruby, with Black & Kastner, September 14-17
(More info: http://rubyurl.com/vmzN)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to