Greetings, fellow Ruby enthusiasts.

Perhaps I have a fundamental misunderstanding here.

I am trying to add a method to Object. It doesn't
seem to be working.

See below. Can someone explain?

Thanks,
Hal Fulton

Program: ---------------------------------------
#!/bin/ruby

def Object.foobar
  print "I am the ultimate foobar!\n"
end

class Foo
  def foobar
    print "I am Foo::foobar... "
    if self.type.superclass.method_defined? "foobar"
      print "my parent has a foobar!\n"
    else
      print "my parent does NOT have a foobar.\n"
    end
    print "My parent is ", self.type.superclass, "\n"
  end
end
      
x = Foo.new
x.foobar

Output: ---------------------------------------
I am Foo::foobar... my parent does NOT have a foobar.
My parent is Object