From: Denis Leclair Date: 2012-08-19T04:13:15+09:00 Subject: Re: accessing protected or private methods from class methods Christopher Dicely wrote in post #1072759: > In a sense what you are asking for is self-contradictory in Ruby -- a > class is > an object (an instance of class Class), and its a different object than > its own > instances. So, when you take a method out of the public interface to > hide it > from "external" code, you are hiding it from class methods because they > are > external code as much as any other method that isn't part of the > instance is. I disagree that this is self-contradictory in Ruby. I understand that they've gone with the "a class is an object" model and that certainly brings a lot of nice characteristics to the language. But that, in and of itself, does not require that class methods be treated as "external code" from the perspective of the class object. There is still a very strong association between the class method and the class object that it is bound to so there's no technical reason why the class method couldn't be given more access privileges than other non-associated code. It must have been a deliberate decision to set it up this way and I'm trying to get an appreciation for why that decision would have been made. Then again, maybe there is a technical reason why those privileges couldn't be given and I'm just not seeing it. -- Posted via http://www.ruby-forum.com/.