From: Dave Thomas Date: 2001-07-06T07:13:00+09:00 Subject: [ruby-talk:17354] Re: Adding a method to a class at the top-level Guillaume Cottenceau writes: > All right :-), yet the conclusion of my message was, can we find a more > elegant way to define an instance method at the top-level? Well, if 'define_method' wasn't private, class Class public :define_method end you could write class Dave # ... end Dave.define_method(:fred) { |str| puts "Hello, #{str}" } d = Dave.new d.fred("Barney") #=> Hello, Barney Dave