Module: RailsDevelopmentBoost::Reloader

Extended by:
Reloader
Included in:
Reloader
Defined in:
lib/rails_development_boost/reloader.rb

Overview

replacement for the Rails’ post fa1d9a file_update_checker

Defined Under Namespace

Modules: RoutesReloaderPatch

Instance Method Summary collapse

Instance Method Details

#executeObject Also known as: updated?



41
42
43
44
# File 'lib/rails_development_boost/reloader.rb', line 41

def execute
  init unless @inited
  @last_run_result = ActiveSupport::Dependencies.unload_modified_files!
end

#execute_if_updatedObject



46
47
48
49
50
# File 'lib/rails_development_boost/reloader.rb', line 46

def execute_if_updated
  @last_run_result.nil? ? execute : @last_run_result
ensure
  @last_run_result = nil
end

#hook_in!Object



35
36
37
38
39
# File 'lib/rails_development_boost/reloader.rb', line 35

def hook_in!
  Rails.application.reloaders.unshift(self)
  ActionDispatch::Reloader.to_prepare(:prepend => true) { RailsDevelopmentBoost::Reloader.execute_if_updated }
  patch_routes_reloader! if Rails::VERSION::MAJOR >= 4
end

#routes_reloaderObject



54
55
56
# File 'lib/rails_development_boost/reloader.rb', line 54

def routes_reloader
  Rails.application.respond_to?(:routes_reloader) && Rails.application.routes_reloader
end