Class: Rage::Reloader

Inherits:
Object
  • Object
show all
Defined in:
lib/rage/middleware/reloader.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Reloader

Returns a new instance of Reloader.



4
5
6
# File 'lib/rage/middleware/reloader.rb', line 4

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/rage/middleware/reloader.rb', line 8

def call(env)
  Rage.code_loader.reload
  @app.call(env)
rescue Exception => e
  exception_str = "#{e.class} (#{e.message}):\n#{e.backtrace.join("\n")}"
  puts(exception_str)
  [500, {}, [exception_str]]
end