Use top level classes during detection.
Inject dependencies immediately if Rails isn't installed.