:to argument to match() -- how is it converted to class/method name

Is there any documentation for how the match command converts the “:to”
argument to a class and method name?

If I have
match ‘’, to: ‘#’,
via: :get
How does it go from to , and
more importantly, how do I go in the reverse direction?

I can probably figure this out via trial-and-error, but I’d like to see
docs if there are some, or contribute some docs if not.

This is not really documented anywhere, and tracing through the source
difficult. Within Rails the string inflector methods #classify and
#underscore are used to go between snake-case names and camel-cased
and module names.

"MyFoo".underscore          # => "my_foo"
"MyApp::Foo".underscore  # => "my_app/foo"
"my_foo".classify         # => "MyFoo"
"my_app/foo".classify  # => "MyApp::Foo"