advanced/dynamic_method_definition.rb
tests/_examples/advanced/dynamic_method_definition.rb in the metorex repository.
MyClass.define_method(:greet) do
puts "Hello from dynamically defined method!"
end
source = MyClass.get_source(:greet)
puts source.statements