Last active
July 25, 2022 08:01
-
-
Save LolWalid/1d6ccf95b6e0a90a90f7f74fedaf3edc to your computer and use it in GitHub Desktop.
How to make private static method in ruby.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass | |
def self.public | |
"I'm public." | |
end | |
private # this is useless | |
def self.private | |
"I'm also public." | |
end | |
end | |
class MyClass2 | |
class << self | |
def public | |
"I'm public." | |
end | |
private | |
def private | |
"I'm private, Yeah !" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
+1