Method: Sinatra::Reloader::BaseMethods#add_filter

Defined in:
lib/sinatra/reloader.rb

#add_filter(type, path = nil, **options, &block) ⇒ Object

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



320
321
322
323
324
325
326
# File 'lib/sinatra/reloader.rb', line 320

def add_filter(type, path = nil, **options, &block)
  source_location = block.respond_to?(:source_location) ?
    block.source_location.first : caller_files[1]
  result = super
  watch_element(source_location, :"#{type}_filter", filters[type].last)
  result
end