Sha256: 78879c8fefe55405e21037b41de6b43ce751f299dc2f553d28d7129fa69c878f

Contents?: true

Size: 564 Bytes

Versions: 3

Compression:

Stored size: 564 Bytes

Contents

# frozen_string_literal: true

require 'rails_compatibility'

class << RailsCompatibility
  if ActiveSupport::VERSION::MAJOR >= 7
    def setup_autoload_paths(paths)
      require 'zeitwerk'
      loader = Zeitwerk::Loader.new

      paths.each do |path|
        ActiveSupport::Dependencies.autoload_paths << path
        loader.push_dir(path)
      end

      loader.setup
    end
  else
    def setup_autoload_paths(paths)
      paths.each do |path|
        ActiveSupport::Dependencies.autoload_paths << path
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_compatibility-0.0.10 lib/rails_compatibility/setup_autoload_paths.rb
rails_compatibility-0.0.9 lib/rails_compatibility/setup_autoload_paths.rb
rails_compatibility-0.0.8 lib/rails_compatibility/setup_autoload_paths.rb