On Tue, Oct 13, 2009 at 12:50 PM, Joshua Muheim
<[email protected]> wrote:
> Nobody knows this?
No.. it's just that no one cares :)
Ruby's private and protected members aren't very private or protected.
It's more of an "intent" thing than a hard rule.
#!/usr/bin/env ruby
class Foo
private
def hidden
puts "I am hidden"
end
end
f = Foo.new
begin
f.hidden
rescue
puts "Can't run hidden: #{ $! }"
end
f.send( :hidden )
> ./private.rb
Can't run hidden: private method `hidden' called for #<Foo:0xb7c2f92c>
I am hidden
What's happening to you is the filter execution only sees private
methods. It's looking for the method name, doesn't find it, and
doesn't run it. Look to see how it appears and disappears from the
private methods list when you move it around.
u = User.find(:first)
u.private_methods
--
Greg Donald
http://destiney.com/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---