Extending the routing system - is it possible to output procs inside module_eval?

Hey,

I was thinking about extending Rails routing system to allow to pass procs as default values for segments e.g.

:path_prefix => "/:locale", :defaults => { :locale => Proc.new { I18n.locale } }

but after checking the code I'm not really sure if it's possible.

The problem is that Rails uses module_eval with string to dynamically generate named route helper methods like this: route_set.rb · GitHub Putting e.g. a proc into options hash causes invalid syntax, because the hash is simply printed there using options.inspect.

Is there any other way to define these methods *and* allow procs in options hash?

Cheers, Szymon