
There are three ways to create a class method in Ruby.
class Rock
def self.info
“Rock bashes scissors.”
end
end
class Paper
class << self
def info
“Paper wraps rock.”
end
end
end
class Scissors
end
def Scissors.info
“Scissors cut paper.”
end
p Rock.info
p Paper.info
p Scissors.info
More Ruby goodness: here, here, and here.
More rochambeau goodness:
(Hat Tip: Emily L.)