lib/page_magic/drivers.rb in page_magic-1.2.9 vs lib/page_magic/drivers.rb in page_magic-2.0.0.alpha1

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'page_magic/driver' require 'page_magic/utils/string' module PageMagic # class Drivers - creates an object that can be used to hold driver definitions # These PageMagic gets the user's chosen driver from this object. @@ -15,10 +17,10 @@ end # Loads drivers defined in files at the given path # @param [String] path where the drivers are located def load(path = "#{__dir__}/drivers") - Dir["#{path}/*.rb"].each do |driver_file| + Dir["#{path}/*.rb"].sort.each do |driver_file| require driver_file driver_name = File.basename(driver_file)[/(.*)\.rb$/, 1] register self.class.const_get(Utils::String.classify(driver_name)) end end