Class: Sinatra::Reloader::Watcher::List
Relationships & Source Files | |
Inherits: | Object |
Defined in: | sinatra-contrib/lib/sinatra/reloader.rb |
Overview
Collection of file ::Sinatra::Reloader::Watcher
that can be associated with a
::Sinatra
application. That way, we can know which files belong
to a given application and which files have been modified. It
also provides a mechanism to inform a ::Sinatra::Reloader::Watcher
of the elements
defined in the file being watched and if its changes should be
ignored.
Class Method Summary
-
.for(app)
Returns the
List
for the applicationapp
. -
.new ⇒ List
constructor
Creates a new
List
instance.
Instance Method Summary
-
#ignore(path)
Tells the
::Sinatra::Reloader::Watcher
for the file located at #path to ignore the file changes, and adds the::Sinatra::Reloader::Watcher
to theList
, if it isn't already there. -
#updated
Returns an array with all the watchers in the
List
that have been updated. -
#watch(path, element)
Lets the
::Sinatra::Reloader::Watcher
for the file located at #path know that theelement
is defined there, and adds the::Sinatra::Reloader::Watcher
to theList
, if it isn't already there. -
#watch_file(path)
Alias for #watcher_for.
-
#watcher_for(path)
(also: #watch_file)
Adds a
::Sinatra::Reloader::Watcher
for the file located at #path to theList
, if it isn't already there. -
#watchers
Returns an array with all the watchers in the
List
.
Constructor Details
.new ⇒ List
Creates a new List
instance.
Class Method Details
.for(app)
Returns the List
for the application app
.
# File 'sinatra-contrib/lib/sinatra/reloader.rb', line 128
def self.for(app) @app_list_map[app] end
Instance Method Details
#ignore(path)
Tells the ::Sinatra::Reloader::Watcher
for the file located at Sinatra::Reloader::Watcher#path to ignore
the file changes, and adds the ::Sinatra::Reloader::Watcher
to the List
, if
it isn't already there.
# File 'sinatra-contrib/lib/sinatra/reloader.rb', line 149
def ignore(path) watcher_for(path).ignore end
#updated
Returns an array with all the watchers in the List
that
have been updated.
#watch(path, element)
Lets the ::Sinatra::Reloader::Watcher
for the file located at Sinatra::Reloader::Watcher#path know that the
element
is defined there, and adds the ::Sinatra::Reloader::Watcher
to the List
,
if it isn't already there.
# File 'sinatra-contrib/lib/sinatra/reloader.rb', line 142
def watch(path, element) watcher_for(path).elements << element end
#watch_file(path)
Alias for #watcher_for.
# File 'sinatra-contrib/lib/sinatra/reloader.rb', line 158
alias watch_file watcher_for
#watcher_for(path) Also known as: #watch_file
Adds a ::Sinatra::Reloader::Watcher
for the file located at Sinatra::Reloader::Watcher#path to the
List
, if it isn't already there.
#watchers
Returns an array with all the watchers in the List
.
# File 'sinatra-contrib/lib/sinatra/reloader.rb', line 161
def watchers @path_watcher_map.values end