Class: Spring::ApplicationWatcher
- Inherits:
-
Object
- Object
- Spring::ApplicationWatcher
- Defined in:
- lib/spring/application_watcher.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#globs ⇒ Object
readonly
Returns the value of attribute globs.
-
#mtime ⇒ Object
readonly
Returns the value of attribute mtime.
Instance Method Summary collapse
- #add_files(new_files) ⇒ Object
- #add_globs(new_globs) ⇒ Object
-
#initialize ⇒ ApplicationWatcher
constructor
A new instance of ApplicationWatcher.
- #reset ⇒ Object
- #stale? ⇒ Boolean
Constructor Details
#initialize ⇒ ApplicationWatcher
Returns a new instance of ApplicationWatcher.
5 6 7 8 9 |
# File 'lib/spring/application_watcher.rb', line 5 def initialize @files = [] @globs = [] @mtime = nil end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
3 4 5 |
# File 'lib/spring/application_watcher.rb', line 3 def files @files end |
#globs ⇒ Object (readonly)
Returns the value of attribute globs.
3 4 5 |
# File 'lib/spring/application_watcher.rb', line 3 def globs @globs end |
#mtime ⇒ Object (readonly)
Returns the value of attribute mtime.
3 4 5 |
# File 'lib/spring/application_watcher.rb', line 3 def mtime @mtime end |
Instance Method Details
#add_files(new_files) ⇒ Object
11 12 13 14 15 |
# File 'lib/spring/application_watcher.rb', line 11 def add_files(new_files) files.concat new_files.select { |f| File.exist?(f) } files.uniq! reset end |
#add_globs(new_globs) ⇒ Object
17 18 19 20 |
# File 'lib/spring/application_watcher.rb', line 17 def add_globs(new_globs) globs.concat new_globs reset end |
#reset ⇒ Object
22 23 24 |
# File 'lib/spring/application_watcher.rb', line 22 def reset @mtime = compute_mtime end |
#stale? ⇒ Boolean
26 27 28 |
# File 'lib/spring/application_watcher.rb', line 26 def stale? mtime < compute_mtime end |