Skip to content

Instantly share code, notes, and snippets.

@rmrfself
Created May 26, 2015 09:24
Show Gist options
  • Save rmrfself/e14c90f95e8fd85d9d5e to your computer and use it in GitHub Desktop.
Save rmrfself/e14c90f95e8fd85d9d5e to your computer and use it in GitHub Desktop.
Keypoint of ruby metaprogramming.
An object is composed of a bunch of instance variables and a link to a
class.
• The methods of an object live in the object’s class. (From the point of view
of the class, they’re called instance methods.)
• The class itself is just an object of class Class. The name of the class is
just a constant.
• Class is a subclass of Module. A module is basically a package of methods.
In addition to that, a class can also be instantiated (with new) or arranged
in a hierarchy (through its superclass).
• Constants are arranged in a tree similar to a file system, where the names
of modules and classes play the part of directories and regular constants
play the part of files.
• Each class has an ancestors chain, beginning with the class itself and
going up to BasicObject.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment