Skip to content

Instantly share code, notes, and snippets.

@reinh
Created May 13, 2010 07:41
Show Gist options
  • Save reinh/399603 to your computer and use it in GitHub Desktop.
Save reinh/399603 to your computer and use it in GitHub Desktop.
class Foo
# an instance method, added to Foo's method table (added to Foo)
def foo
end
# a class method, added to Foo's singleton class (because only classes can
# store methods, so a class method must be a method on "the class's class")
def Foo.foo
end
# a class method, added to self's singleton class (in this case, self is Foo:
# self could also be a subclass)
def self.foo
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment