Thursday, April 24, 2008

Some chewable Ruby

1. An anonymous class is a Singleton class which when created sits between an instance and it's metadata. Basically it takes over the klass relationship on the instance end and relates to the metadata through the super.
2. A class is also an instance in Ruby. So, a class instance variable goes into the Singleton between a Class Definition and the Class Metadata. Therefore, it is visible only to the methods in Class Metadata or in simpler words, only to that class methods of which it is the instance.
3. Instance methods belong in the Class definition and class methods in the Class metadata.
4. The metadata class can be found by following the klass property.

No comments: