Skip to content
May 18, 2010 / zlost

Ruby Metaclass Mindfuck

class Foo; end
f = Foo.new

f.kind_of? Foo # => true
f.kind_of? Object # => true

# so far so good... now let's get in to metaclasses

Foo.kind_of? Class # => true

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

 

mind.blown? # => true

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s