Re:Expose any Ruby object over the web. An interesting littl...
by steveklabnik on Tuesday November 16, 2010 @02:49PM
(#1911337)
No, don't feel bad. That's awesome. I knew that thing about adding true, I just didn't realize that exec was private.
This made sense to me since I'd assume respond_to? would only yield true if it were possible to make the call without error. Yet, this logic does not hold true:
So it seems it doesn't matter if the private method is callable or not, respond_to? won't give you a true for any private method, accessible in the current scope or not, unless you pass the extra flag.(I'm not really writing all of this to give you an education, more to give me one. I was totally unaware of all this and found it interesting :-))