Applying `self` in a Ruby Module?
If I”m using a Ruby Module, and I call self - what is self in a module?
module Car
def start
puts "#{self} is starting"
self
end
end
class Toyota
include Car
end
camry = Toyota.new
camry.start
###Q: Can you guess what self is?
camry.start
#=> #<Toyota:0x000055f9d9f853a8> is starting
puts camry.start == camry
# => true
And we can see that self is a Toyota instance - that is starting!
Written on July 16, 2026