Class: Sinatra::Reloader::Watcher
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Inherits: | Object |
Defined in: | sinatra-contrib/lib/sinatra/reloader.rb |
Overview
Watches a file so it can tell when it has been updated, and what elements does it contain.
Class Method Summary
-
.new(path) ⇒ Watcher
constructor
Creates a new
Watcher
instance for the file located at #path.
Instance Attribute Summary
- #elements readonly
-
#ignore
readonly
Informs that the modifications to the file being watched should be ignored.
-
#ignore? ⇒ Boolean
readonly
Indicates whether or not the modifications to the file being watched should be ignored.
-
#inline_templates? ⇒ Boolean
readonly
Indicates whether or not the file being watched has inline templates.
- #mtime readonly
- #path readonly
-
#removed? ⇒ Boolean
readonly
Indicates whether or not the file being watched has been removed.
-
#updated? ⇒ Boolean
readonly
Indicates whether or not the file being watched has been modified.
Instance Method Summary
-
#update
Updates the mtime of the file being watched.
Constructor Details
.new(path) ⇒ Watcher
Creates a new Watcher
instance for the file located at #path.
Instance Attribute Details
#elements (readonly)
[ GitHub ]#ignore (readonly)
Informs that the modifications to the file being watched should be ignored.
# File 'sinatra-contrib/lib/sinatra/reloader.rb', line 200
def ignore @ignore = true end
#ignore? ⇒ Boolean
(readonly)
Indicates whether or not the modifications to the file being watched should be ignored.
# File 'sinatra-contrib/lib/sinatra/reloader.rb', line 206
def ignore? !!@ignore end
#inline_templates? ⇒ Boolean
(readonly)
Indicates whether or not the file being watched has inline templates.
# File 'sinatra-contrib/lib/sinatra/reloader.rb', line 194
def inline_templates? elements.any? { |element| element.type == :inline_templates } end
#mtime (readonly)
[ GitHub ]#path (readonly)
[ GitHub ]
#removed? ⇒ Boolean
(readonly)
Indicates whether or not the file being watched has been removed.
# File 'sinatra-contrib/lib/sinatra/reloader.rb', line 211
def removed? !File.exist?(path) end
#updated? ⇒ Boolean
(readonly)
Indicates whether or not the file being watched has been modified.
Instance Method Details
#update
Updates the mtime of the file being watched.