Sha256: f7efdc24cb26323694fc5a9f3c5dd68ad9f958d7bc7584b3670ecec7a54b05ce
Contents?: true
Size: 532 Bytes
Versions: 16
Compression:
Stored size: 532 Bytes
Contents
require 'listen' class CodeReloader def initialize(path) $log.warn("code.reloader", active: true, path: path) Listen.to(path) do |m, a, r| Thread.name = "Code Reloader (#{path})" (m + a).uniq.each do |file| reload(file) end end.start end def reload(file) if file =~ /\.rb$/ $log.info("code.reloader", reload: file) begin load(file) rescue SyntaxError => e $log.exception(e) rescue => e $log.exception(e) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems