Last active
December 10, 2015 19:48
-
-
Save jc3wmdev/4483612 to your computer and use it in GitHub Desktop.
class methods 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 Article | |
#class method | |
def self.publish | |
....... | |
end | |
end | |
# all class methods | |
class << Article | |
def publish | |
... | |
end | |
def annouce | |
.... | |
end | |
end | |
# mix of instance and class methods. | |
class Article | |
def initialize(content) | |
... | |
end | |
#instance method | |
def addContent | |
... | |
end | |
class << self | |
def publish | |
.... | |
end | |
def announce | |
.... | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment