Dynamically create autoload command from filenames in Ruby Dynamically create autoload command from filenames in Ruby selenium selenium

Dynamically create autoload command from filenames in Ruby


How about you use require to load your dependency in the file that needs it?

require loads a file only once, so you shouldn't encounter any side effects.

Or, even better, you can use auto_load, which uses require under the hood, but it does it in a smarter way

autoload :ActiveAdminLoginPage, 'active_admin_login_page'