Class | Merb::BootLoader::ReloadClasses |
In: |
merb-core/lib/merb-core/bootloader.rb
|
Parent: | Merb::BootLoader |
Reloads all files which have been modified since they were last loaded.
nil
:api: private
# File merb-core/lib/merb-core/bootloader.rb, line 1372 1372: def self.reload(paths) 1373: paths.each do |file| 1374: next if LoadClasses::MTIMES[file] && 1375: LoadClasses::MTIMES[file] == File.mtime(file) 1376: 1377: LoadClasses.reload(file) 1378: end 1379: 1380: nil 1381: end
Set up the class reloader if class reloading is enabled. This checks periodically for modifications to files loaded by the LoadClasses BootLoader and reloads them when they are modified.
nil
:api: plugin
# File merb-core/lib/merb-core/bootloader.rb, line 1342 1342: def self.run 1343: return unless Merb::Config[:reload_classes] 1344: 1345: paths = [] 1346: Merb.load_paths.each do |path_name, file_info| 1347: path, glob = file_info 1348: next unless glob 1349: paths << Dir[path / glob] 1350: end 1351: 1352: if Merb.dir_for(:application) && File.file?(Merb.dir_for(:application)) 1353: paths << Merb.dir_for(:application) 1354: end 1355: 1356: paths.flatten! 1357: 1358: TimedExecutor.every(Merb::Config[:reload_time] || 0.5) do 1359: GC.start 1360: reload(paths) 1361: end 1362: 1363: nil 1364: end