Sinatra::Reloader::ExtensionMethods

Contains the methods that the extension adds to the Sinatra application.

Public Instance Methods

also_reload(*glob) click to toggle source

Indicates with a glob which files should be reloaded if they have been modified. It can be called several times.

# File lib/sinatra/reloader.rb, line 360
def also_reload(*glob)
  Dir[*glob].each { |path| Watcher::List.for(self).watch_file(path) }
end
deactivate(element) click to toggle source

Removes the element from the Sinatra application.

# File lib/sinatra/reloader.rb, line 339
def deactivate(element)
  case element.type
  when :route then
    verb      = element.representation[:verb]
    signature = element.representation[:signature]
    (routes[verb] ||= []).delete(signature)
  when :middleware then
    @middleware.delete(element.representation)
  when :before_filter then
    filters[:before].delete(element.representation)
  when :after_filter then
    filters[:after].delete(element.representation)
  when :error then
    code    = element.representation[:code]
    handler = element.representation[:handler]
    @errors.delete(code) if @errors[code] == handler
  end
end
dont_reload(*glob) click to toggle source

Indicates with a glob which files should not be reloaded even if they have been modified. It can be called several times.

# File lib/sinatra/reloader.rb, line 366
def dont_reload(*glob)
  Dir[*glob].each { |path| Watcher::List.for(self).ignore(path) }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.