Method access in Ruby
methods, ruby
Solution
The definition of the "homer" method is adding the method to the Object class. It is not defining a free function.
Class Candy implicitly inherits from Object, and so has access to the methods in Object. When you call "homer" in the "land" method, the method resolution can't find a definition in the current class, goes to the super class, finds the method you have added to Object, and calls it.
Problem
How is it that Ruby allows a class access methods outside of the class implicitly? Example: ``` class Candy def land homer end end def homer puts "Hello" end Candy.new.land #Outputs Hello ```