Class: Minipack::FileChangeWatcher
- Inherits:
-
Object
- Object
- Minipack::FileChangeWatcher
- Defined in:
- lib/minipack/file_change_watcher.rb
Instance Method Summary collapse
-
#fresh? ⇒ Boolean
Returns true if all watched files are up to date.
-
#initialize(watched_paths, digest_store_path) ⇒ FileChangeWatcher
constructor
A new instance of FileChangeWatcher.
- #record_digest ⇒ Object
-
#stale? ⇒ Boolean
Returns true if the watched files are out of date.
Constructor Details
#initialize(watched_paths, digest_store_path) ⇒ FileChangeWatcher
Returns a new instance of FileChangeWatcher.
10 11 12 13 |
# File 'lib/minipack/file_change_watcher.rb', line 10 def initialize(watched_paths, digest_store_path) @watched_paths = watched_paths @digest_store_path = Pathname.new(digest_store_path) end |
Instance Method Details
#fresh? ⇒ Boolean
Returns true if all watched files are up to date
16 17 18 |
# File 'lib/minipack/file_change_watcher.rb', line 16 def fresh? watched_files_digest == last_stored_digest end |
#record_digest ⇒ Object
25 26 27 28 |
# File 'lib/minipack/file_change_watcher.rb', line 25 def record_digest @digest_store_path.dirname.mkpath @digest_store_path.write(watched_files_digest) end |
#stale? ⇒ Boolean
Returns true if the watched files are out of date
21 22 23 |
# File 'lib/minipack/file_change_watcher.rb', line 21 def stale? !fresh? end |