From: bwv549 Date: 2007-08-31T03:55:03+09:00 Subject: Add a method to a class at runtime? module SomeModule def happy? puts 'yes' end end # I can do this: some_object.extend(SomeModule) some_object.happy? # -> 'yes' # But I really need to give the class the method (not just instances) # because I have a collection of hundreds of thousands of objects # and need them all to have the method quickly. # The problem is that I don't know the class that needs to include the method # until runtime! # This won't work: some_object.class.include(SomeModule) # -> NoMethodError: private method `include' called for # What is the workaround to add a method to a class (known only at runtime)? Thanks