Root router

I have 2 domains: "myap.com" and "myap.net".

Is it possible to configure routes.rb:

if domain is "myap.com" then map.root => "com"
if domain is "myap.net" then map.root => "net"