Class: Pith::Watcher
- Inherits:
-
Object
- Object
- Pith::Watcher
- Defined in:
- lib/pith/watcher.rb
Constant Summary collapse
- DEFAULT_INTERVAL =
2
Instance Attribute Summary collapse
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(project, options = {}) ⇒ Watcher
constructor
A new instance of Watcher.
Constructor Details
#initialize(project, options = {}) ⇒ Watcher
Returns a new instance of Watcher.
7 8 9 10 11 12 13 |
# File 'lib/pith/watcher.rb', line 7 def initialize(project, = {}) @project = project @interval = DEFAULT_INTERVAL .each do |k,v| send("#{k}=", v) end end |
Instance Attribute Details
#interval ⇒ Object
Returns the value of attribute interval.
16 17 18 |
# File 'lib/pith/watcher.rb', line 16 def interval @interval end |
#project ⇒ Object
Returns the value of attribute project.
15 16 17 |
# File 'lib/pith/watcher.rb', line 15 def project @project end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pith/watcher.rb', line 18 def call loop do begin project.build sleep(interval) rescue Interrupt break end end end |