lib/rack/unreloader/reloader.rb
def reload!
        changed_files = []

        @monitor_dirs.keys.each do |dir|
          check_monitor_dir(dir, changed_files)
        end

        removed_files = []
        delete_hooks = []

        @monitor_files.to_a.each do |file, (time, delete_hook)|
          if File.file?(file)
            if file_changed?(file, time)
              changed_files << file
            end
          else
            delete_hooks << [delete_hook, file] if delete_hook
            removed_files << file
          end
        end

        remove_files(removed_files)
        delete_hooks.each{|hook, file| hook.call(file)}

        return if changed_files.empty?

        unless @dependencies.empty?
          changed_files = reload_files(changed_files)
          changed_files.flatten!
          changed_files.map!{|f| File.directory?(f) ? Unreloader.ruby_files(f) : f}
          changed_files.flatten!
          changed_files.uniq!
          
          order = @dependency_order
          order &= changed_files
          changed_files = order + (changed_files - order)
        end

        unless @skip_reload.empty?
          skip_reload = @skip_reload.map{|f| File.directory?(f) ? Unreloader.ruby_files(f) : f}
          skip_reload.flatten!
          skip_reload.uniq!
          changed_files -= skip_reload
        end

        changed_files.each do |file|
          safe_load(file, FORCE)
        end
      end
# If there are any changed files, reload them.  If there are no changed
# files, do nothing.
If there are any changed files, reload them.  If there are no changed
files, do nothing.
If there are any changed files reload them . If there are no changed files do nothing .
def reload!
        changed_files = []
        @monitor_dirs.keys.each do |dir|
          check_monitor_dir(dir, changed_files)
        end
        removed_files = []
        delete_hooks = []
        @monitor_files.to_a.each do |file, (time, delete_hook)|
          if File.file?(file)
            if file_changed?(file, time)
              changed_files << file
            end
          else
            delete_hooks << [delete_hook, file] if delete_hook
            removed_files << file
          end
        end
        remove_files(removed_files)
        delete_hooks.each{|hook, file| hook.call(file)}
        return if changed_files.empty?
        unless @dependencies.empty?
          changed_files = reload_files(changed_files)
          changed_files.flatten!
          changed_files.map!{|f| File.directory?(f) ? Unreloader.ruby_files(f) : f}
          changed_files.flatten!
          changed_files.uniq!
          order = @dependency_order
          order &= changed_files
          changed_files = order + (changed_files - order)
        end
        unless @skip_reload.empty?
          skip_reload = @skip_reload.map{|f| File.directory?(f) ? Unreloader.ruby_files(f) : f}
          skip_reload.flatten!
          skip_reload.uniq!
          changed_files -= skip_reload
        end
        changed_files.each do |file|
          safe_load(file, FORCE)
        end
      end
def reload! changed_files = [ ] @monitor_dirs . keys . each do | dir | check_monitor_dir ( dir , changed_files ) end removed_files = [ ] delete_hooks = [ ] @monitor_files . to_a . each do | file , ( time , delete_hook ) | if File . file? ( file ) if file_changed? ( file , time ) changed_files << file end else delete_hooks << [ delete_hook , file ] if delete_hook removed_files << file end end remove_files ( removed_files ) delete_hooks . each { | hook , file | hook . call ( file ) } return if changed_files . empty? unless @dependencies . empty? changed_files = reload_files ( changed_files ) changed_files . flatten! changed_files . map! { | f | File . directory? ( f ) ? Unreloader . ruby_files ( f ) : f } changed_files . flatten! changed_files . uniq! order = @dependency_order order &= changed_files changed_files = order + ( changed_files - order ) end unless @skip_reload . empty? skip_reload = @skip_reload . map { | f | File . directory? ( f ) ? Unreloader . ruby_files ( f ) : f } skip_reload . flatten! skip_reload . uniq! changed_files -= skip_reload end changed_files . each do | file | safe_load ( file , FORCE ) end end
If there are any changed files, reload them.
If there are any changed files reload them .