Speaking of elegance, you can change this:

  class <<self;self;end.class_eval code

to this:

  instance_eval(code)

-- 
Posted via http://www.ruby-forum.com/.