Class: Sinatra::Reloader

Inherits:
Rack::Reloader
  • Object
show all
Defined in:
lib/sinatra/reloader.rb

Overview

Reload scripts and reset routes on change

Instance Method Summary collapse

Instance Method Details

#safe_load(file, mtime, stderr = $stderr) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/sinatra/reloader.rb', line 3

def safe_load(file, mtime, stderr = $stderr)
  if file == ::Sinatra::Application.app_file
    ::Sinatra::Application.reset!
    ::Sinatra::Application.clear_cache! if ::Sinatra::Application.respond_to? :clear_cache!
    stderr.puts "#{self.class}: reseting routes and cache"
  end
  super
end