Class: Filewatcher::SpecHelper::RubyWatchRun
- Inherits:
-
Object
- Object
- Filewatcher::SpecHelper::RubyWatchRun
- Includes:
- WatchRun
- Defined in:
- lib/filewatcher/spec_helper/ruby_watch_run.rb
Overview
Ruby API watcher for specs
Constant Summary
Constants included from WatchRun
WatchRun::TMP_DIR, WatchRun::TMP_FILES_DIR
Constants included from Filewatcher::SpecHelper
ENVIRONMENT_SPECS_COEFFICIENTS
Instance Attribute Summary collapse
-
#filewatcher ⇒ Object
readonly
Returns the value of attribute filewatcher.
-
#processed ⇒ Object
readonly
Returns the value of attribute processed.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
-
#watched ⇒ Object
readonly
Returns the value of attribute watched.
Attributes included from WatchRun
Instance Method Summary collapse
-
#initialize(filewatcher:, **args) ⇒ RubyWatchRun
constructor
A new instance of RubyWatchRun.
- #start ⇒ Object
- #stop ⇒ Object
- #wait(seconds: 1) ⇒ Object
Methods included from WatchRun
Methods included from Filewatcher::SpecHelper
#debug, #environment_specs_coefficients, #logger, #system_stat, #system_stat_windows, #wait_with_block, #wait_without_block
Constructor Details
#initialize(filewatcher:, **args) ⇒ RubyWatchRun
Returns a new instance of RubyWatchRun.
13 14 15 16 17 18 |
# File 'lib/filewatcher/spec_helper/ruby_watch_run.rb', line 13 def initialize(filewatcher:, **args) super(**args) @filewatcher = filewatcher @mutex = Mutex.new end |
Instance Attribute Details
#filewatcher ⇒ Object (readonly)
Returns the value of attribute filewatcher.
11 12 13 |
# File 'lib/filewatcher/spec_helper/ruby_watch_run.rb', line 11 def filewatcher @filewatcher end |
#processed ⇒ Object (readonly)
Returns the value of attribute processed.
11 12 13 |
# File 'lib/filewatcher/spec_helper/ruby_watch_run.rb', line 11 def processed @processed end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
11 12 13 |
# File 'lib/filewatcher/spec_helper/ruby_watch_run.rb', line 11 def thread @thread end |
#watched ⇒ Object (readonly)
Returns the value of attribute watched.
11 12 13 |
# File 'lib/filewatcher/spec_helper/ruby_watch_run.rb', line 11 def watched @watched end |
Instance Method Details
#start ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/filewatcher/spec_helper/ruby_watch_run.rb', line 20 def start super @thread = thread_initialize # thread needs a chance to start wait seconds: 1 wait do keep_watching = filewatcher.keep_watching debug "keep_watching = #{keep_watching}" keep_watching end end |
#stop ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/filewatcher/spec_helper/ruby_watch_run.rb', line 32 def stop thread.exit wait do thread.stop? end super end |
#wait(seconds: 1) ⇒ Object
42 43 44 |
# File 'lib/filewatcher/spec_helper/ruby_watch_run.rb', line 42 def wait(seconds: 1) super seconds: seconds, interval: filewatcher.interval end |