Method: Sinatra::Reloader::BaseMethods#compile!

Defined in:
lib/sinatra/reloader.rb

#compile!(verb, path, block, **options) ⇒ Object

Does everything Sinatra::Base#route does, but it also tells the Watcher::List for the Sinatra application to watch the defined route.

Note: We are using #compile! so we don’t interfere with extensions changing #route.



288
289
290
291
292
293
294
295
296
# File 'lib/sinatra/reloader.rb', line 288

def compile!(verb, path, block, **options)
  source_location = block.respond_to?(:source_location) ?
    block.source_location.first : caller_files[1]
  signature = super
  watch_element(
    source_location, :route, { verb: verb, signature: signature }
  )
  signature
end