First, let me show some code:
require 'magic'
a = Person.new
a.first_name = "Daniel"
a.last_name = "Mitterdorfer"
puts "My name is #{a.first_name} #{a.last_name}."
Well, that's not that interesting, but what if I tell you that I have not defined #first_name and #last_name? To be honest, there is even no definition of Person at all.
How does it work? The code that makes this example work is in magic.rb. It utilizes Module#contant_missing to define a proxy for missing classes and Proxy#method_missing for the dynamic definition of methods. Unfortunately, magic.rb is, - hmm - let's say 'quite in progress' and not very sophisticated yet. However, with a more sophisticated version of magic.rb I could probably write a DSL for the insertion of arbitrary records into a database or an O/R mapping layer that does not need any classes. Stay tuned.