Sha256: 2a191dff729ee9a02468c0b8efba1b14718b58ea4deb6a9597bad22b8713e693

Contents?: true

Size: 897 Bytes

Versions: 2

Compression:

Stored size: 897 Bytes

Contents

#--
# Copied from Wee 0.8.0
# Autoreload (c) 2004 Michael Neumann.
#++

module Kernel

  #--
  # TODO
  #++
  def autoreload(check_interval=10)
    Thread.new(Time.now) { |start_time|
      file_mtime = {}
      loop {
        sleep check_interval 
        $LOADED_FEATURES.each { |feature|
          $LOAD_PATH.each { |lp|
            file = File.join(lp, feature)
            if (File.exists?(file) and
              File.stat(file).mtime > (file_mtime[file] || start_time))
              file_mtime[file] = File.stat(file).mtime
              STDERR.puts "reload #{ file }"
              begin
                load(file)
              rescue Exception => e
                STDERR.puts e.inspect
              end
            end
          }
        }
      }
    }
  end

end




#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# TODO

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facets-0.9.0 lib/nano/kernel/autoreload.rb
facets-1.0.0 lib/facet/kernel/autoreload.rb