module Hasu

Constants

VERSION

Public Class Methods

error() click to toggle source
# File lib/hasu.rb, line 20
def self.error
  @error
end
error=(error) click to toggle source
# File lib/hasu.rb, line 24
def self.error=(error)
  @error = error

  if @error
    $stderr.puts @error.inspect
    $stderr.puts @error.backtrace.join("\n")
  end
end
load(path) click to toggle source
Calls superclass method
# File lib/hasu.rb, line 9
def self.load(path)
  reloads[path] = File.exist?(path) ? File.mtime(path) : Time.now
  begin
    super
    true
  rescue Exception => e
    Hasu.error = e
    false
  end
end
reload!() click to toggle source
# File lib/hasu.rb, line 33
def self.reload!
  to_reload = reloads.select{|f,t| File.exist?(f) && File.mtime(f) > t}

  !to_reload.empty? && to_reload.all? do |file,_|
    puts "Reloading #{file}"
    load(file)
  end
end
reloads() click to toggle source
# File lib/hasu.rb, line 5
def self.reloads
  @files ||= {}
end