Skip to content

Instantly share code, notes, and snippets.

@jc3wmdev
Last active December 10, 2015 19:48
Show Gist options
  • Save jc3wmdev/4483612 to your computer and use it in GitHub Desktop.
Save jc3wmdev/4483612 to your computer and use it in GitHub Desktop.
class methods in ruby
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