Sha256: 5ee05bd8c001c2cc3930f0eb1cb7672db2a941de00ce4d8a822361188686b845
Contents?: true
Size: 564 Bytes
Versions: 10
Compression:
Stored size: 564 Bytes
Contents
module Dasht class Reloader attr_accessor :parent def initialize(parent) @parent = parent @last_modified = File.mtime($PROGRAM_NAME) end def changed? @last_modified != File.mtime($PROGRAM_NAME) end def run Thread.new do while true unless changed? sleep 0.3 next end parent.log("Reloading #{$PROGRAM_NAME}...") eval(IO.read($PROGRAM_NAME)) @last_modified = File.mtime($PROGRAM_NAME) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems