Sha256: 84038342e80c63c6724cc4065db759f2c9ced2f20391894f40d8b7e17a165bef

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

class SmartIoC::Railtie < Rails::Railtie
  initializer "smart_ioc.watching_for_bean_changes" do |app|
    if app.config.reload_classes_only_on_change
      bean_file_locations = SmartIoC::BeanLocations.get_all_bean_files

      reloader = app.config.file_watcher.new(bean_file_locations) do
        SmartIoC.container.force_clear_scopes
      end

      app.config.to_prepare { reloader.execute_if_updated }
    end
  end

  console do
    module Rails::ConsoleMethods
      alias :old_reload! :reload!

      def reload!(print = true)
        SmartIoC.container.force_clear_scopes
        old_reload!(print = true)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smart_ioc-0.2.0 lib/smart_ioc/railtie.rb