Sha256: 52a6066b24a4eda6eb0f8794ae26c64059fd90821286ba2c0cc612cfeb0bc4df

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

module HeavyControl
  module ExplicitLoader
    class << self
      def apply
        load_consts # explicit loading for production

        reloader_class.to_prepare do # handle reloading in dev mode
          HeavyControl::ExplicitLoader.load_consts
        end
      end

      def load_consts
        HeavyControl.config[:always_load].each(&:constantize)
      end

      private

      def reloader_class
        case Rails::VERSION::MAJOR
        when 5 then ActiveSupport::Reloader
        when 4 then ActionDispatch::Reloader
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heavy_control-0.1.3 lib/heavy_control/explicit_loader.rb