instance_eval in the routing DSL

DHH mentioned in his talk at railsconf that he was toying with the
idea of using instance_eval in the routing API to make it less verbose
or more concise or whatever.

I just wanted to point out a related alternative to using a plain
instance_eval. Which gets you a little more but also makes things a
little more complicated.

Rather than just instance_eval()ing on some proxy object we could dup
the self object of the current binding, mix in some module which would
handle the routing methods, and then call instance_eval on the dup()ed
self. This way 'self' will be almost identical to the way it is in
todays routing API. The only difference being modifications to self
would not persist outside of the block.


def Routes.draw(*args, &blk)
  dup_self = eval('self', blk).dup
  dup_self.extend RoutingDSL

just some thoughts...