> “ActiveSupport::CoreExtensions::String::Inflections”.underscore
=> “active_support/core_extensions/string/inflections”
> “ActiveSupport::CoreExtensions::String::Inflections”.underscore.camelize
=> “ActiveSupport::CoreExtensions::String::Inflections”
Looks like Rails extension to the string class does more than underscore a string. Which is useful, but shouldn’t the name be “relative_path” or something similar? When I see the method name “underscore” I know exactly what it means, except that’s not what it does. The opposite of “underscore” is “camelize “ which, again, may not have the best name.
And if you want to find the declared constant specified in a string:
> “ActiveSupport::CoreExtensions::String::Inflections”.constantize
=> ActiveSupport::CoreExtensions::String::Inflections
Useful and an excellent name.