oop/module_reopen_instance_methods.rb

tests/_examples/oop/module_reopen_instance_methods.rb in the metorex repository.

class Module
  def described
    "module method on #{name}"
  end
end

class Class
  def built
    "class method on #{name}"
  end
end

module Mixin
end

class Widget
end

puts Mixin.described
puts Widget.described
puts Widget.built
puts Widget.respond_to? :described

Output:

module method on Mixin
module method on Widget
class method on Widget
true