Skip to content
November 1, 2010 / zlost

More Ruby Metaprogramming

Following is a follow-up to this foul-titled file</alliteration>. It began life as a mere edit, but I soon realized that it may be either a) worthy of its own post, or b) a good way to make this blog appear apparently more active than it in fact is. Besides changing themes, that is.

All joking aside, for those of you not interesting in going back and reading that post, I think the following can stand on its own.</ado>

This no longer seems weird to me. Maybe I’be gotten used to the idea, or maybe I’ve achieved a better understanding of why this is true. Internalized it, perhaps.

If I may take a stab at expressing it in words… And it’s my blog so I guess so:

All objects are instances of the Object class. Everything that has a name in ruby is an object.

Class.instance_of? Object # => true
Object.instance_of? Class #=> true

And furthermore:

Class.instance_of? Class # => true

What a lovely triangle we’ve discovered.

[edit] Make that a square:

Object.instance_of? Object # => true


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: