Making class methods re-usable from modules (in Ruby)
Posted by jgrant, 2007-06-25 14:59:04
module TestMod
enddef TestMod.append_features(klass)
def klass.method
puts "#{self}: in method"
end
end
class Class1
include TestMod
end
class Class2
include TestMod
end
Class1.method()
Class2.method()
This should work even without the authors code available.
