Method: Sinatra::Base.reset!

Defined in:
lib/sinatra/base.rb

.reset!Object

Removes all routes, filters, middleware and extension hooks from the current class (not routes/filters/... defined by its superclass).



1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
# File 'lib/sinatra/base.rb', line 1313

def reset!
  @conditions     = []
  @routes         = {}
  @filters        = { before: [], after: [] }
  @errors         = {}
  @middleware     = []
  @prototype      = nil
  @extensions     = []

  @templates = if superclass.respond_to?(:templates)
                 Hash.new { |_hash, key| superclass.templates[key] }
               else
                 {}
               end
end