Module: Sinatra::Reloader::ExtensionMethods
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/reloader.rb
Overview
Contains the methods that the extension adds to the Sinatra application.
Instance Method Summary collapse
-
#also_reload(*glob) ⇒ Object
Indicates with a
glob
which files should be reloaded if they have been modified. -
#deactivate(element) ⇒ Object
Removes the
element
from the Sinatra application. -
#dont_reload(*glob) ⇒ Object
Indicates with a
glob
which files should not be reloaded even if they have been modified.
Instance Method Details
#also_reload(*glob) ⇒ Object
Indicates with a glob
which files should be reloaded if they have been modified. It can be called several times.
383 384 385 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/reloader.rb', line 383 def also_reload(*glob) Dir[*glob].each { |path| Watcher::List.for(self).watch_file(path) } end |
#deactivate(element) ⇒ Object
Removes the element
from the Sinatra application.
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/reloader.rb', line 362 def deactivate(element) case element.type when :route verb = element.representation[:verb] signature = element.representation[:signature] (routes[verb] ||= []).delete(signature) when :middleware @middleware.delete(element.representation) when :before_filter filters[:before].delete(element.representation) when :after_filter filters[:after].delete(element.representation) when :error code = element.representation[:code] handler = element.representation[:handler] @errors.delete(code) if @errors[code] == handler end end |
#dont_reload(*glob) ⇒ Object
Indicates with a glob
which files should not be reloaded even if they have been modified. It can be called several times.
389 390 391 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/reloader.rb', line 389 def dont_reload(*glob) Dir[*glob].each { |path| Watcher::List.for(self).ignore(path) } end |