Last active
January 28, 2016 15:20
-
-
Save LolWalid/9fa1ccddae6713f19c4a to your computer and use it in GitHub Desktop.
How to define private class method ruby
This file contains 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 CoolClass | |
# This is the documentation | |
# # return a string containing Something Cool or Something Coolest ! | |
# arg1 = boolean # Default value to true | |
# CoolClass.cool_method # return 'Something Cool' | |
# CoolClass.cool_method(false) # return 'Something Coolest' | |
def self.cool_method(arg1 = true) | |
return public_method1 if arg1 | |
private_method1 | |
end | |
class << self | |
def public_method1 | |
'Something Cool' | |
end | |
private | |
def private_method1 | |
'Something Coolest !' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just to be clear, this is a 'How to' make private class method in ruby.
Very hepfull.