Skip to content

Instantly share code, notes, and snippets.

@DouglasAllen
Last active August 29, 2015 14:13
Show Gist options
  • Save DouglasAllen/b7dea24dc4d1fc0d6e0e to your computer and use it in GitHub Desktop.
Save DouglasAllen/b7dea24dc4d1fc0d6e0e to your computer and use it in GitHub Desktop.
Classes are Objects
self
#=> main
self.class
#=> Object
self.object_id
#=> -595331298
o = Object.new
#=> #<Object:0xb940af38>
# A Ruby object has a class
o.class
#=> Object
# objects are a class in Ruby
Object.class
#=> Class
Class.superclass
#=> Module
Class.superclass.superclass
#=> Object
Class.superclass.superclass.superclass
#=> BasicObject
Class.superclass.superclass.superclass.superclass
#=> nil
Object.superclass
#=> BasicObject
Object.superclass.superclass
#=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment