Meta-object-class-thingies in Ruby

Posted by amy on June 08, 2007

Today I read RubyFleebie on the Ruby Object Model :

Objects are instances of Classes, which are, of course, also objects. Object methods are stored inside the instance of their Class, but Class methods are stored inside something called a meta-class. The superclass of a meta-class is a meta-object-class. Or something like that.

Or just say, like the famous (to parents of preschoolers, anyway)three singing pigs: “la, la, la, everything’s an object!” and file it under “huh?!” along with dependency injection.

Anyway, the most important takeaway from this blog post (and yes, Max, I did use the term “takeaway” just to annoy you!) is that in Ruby even things that do not look anything like objects are objects. Unless they’re methods, even when they don’t look like methods. Which is why you can use the simply gorgeous construction 5.times do { #some stuff }. Look ma, no primitives!

quack. quack.

Theoretically Related Posts
  • 10 things you should know about method_missing
  • Rails Ninjas We Are Not
  • Transactional fixtures in Rails: a head-banger
  • A Word On Job Descriptions
  • Trackbacks

    Use this link to trackback from your own site.

    Comments

    Leave a response

    Comments