I got to learn that “private” label in a class definition doesn’t
apply to class methods. But I saw many existed source code defining
class methods after “private” label. For example, in the book “Agile
Web D. with Rails 2nd”, I saw following code snippet:
class User < ActiveRecord::Base
…
def password=(pwd)
…
end
private
def self.encrypted_password(password, salt)
…
end
end
If private has no effect on the visibility of class method
“self.encrypted_password”, I am wondering why the author put its
definition there. This isn’t the only place I found class methods are
defined under “private” label. So I guess there may be other
intentions I don’t know. Is there anyone giving some hints on this?
Thanks in advance!