Created
December 27, 2017 23:09
-
-
Save onelharrison/16e1edf55f508d7a0c5ddb8d4653fda5 to your computer and use it in GitHub Desktop.
Code snippet showing how to define public class methods in 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 Toyota < Car | |
def self.name | |
"Toyota #{superclass}" | |
end | |
end | |
# => Toyota.name | |
# "Toyota Car" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment