Image of Lucian Ghinda writing for notes.ghinda.com
September 29th, 2025

In Ruby who's already there in main?

When you open a Ruby file who's already there?
puts self.inspect \# main
puts self.__id__ \# 16 
puts self.class.name \# Object

puts method(:inspect).owner.class \# Object
Why does `inspect` say `main`?  This is a special case defined in the Ruby implementation:
CRuby source code
docs.ruby-lang.org is explicit about this behavior
Screenshot of Object\#to_s from docs.ruby-language.org
What other objects were instantiated before the main one? It seems only another one: `Class`
ObjectSpace used to show other objects instantiated before current one