Reputation: 4923
I have a class with N methods. I want to set one of these methods to private. How can I do this?
Upvotes: 5
Views: 775
Reputation: 20791
I like this way:
class Example
def public_method1
end
private def used_by_public_method1
end
def public_method2
end
end
Another option (that I find more confusing):
class Example
def public_method1
end
def public_method2
end
private
def used_by_public_method1
end
# Don't accidentally put public methods down here.
end
Upvotes: 0
Reputation: 7715
class Example
def methodA
end
def methodP
end
private :methodP
end
Upvotes: 14