Class: PRSS::Watcher
- Inherits:
-
Object
- Object
- PRSS::Watcher
- Defined in:
- lib/prss/watcher.rb
Instance Method Summary collapse
-
#initialize(feed) ⇒ Watcher
constructor
A new instance of Watcher.
- #start(interval, output) ⇒ Object
Constructor Details
#initialize(feed) ⇒ Watcher
Returns a new instance of Watcher.
3 4 5 |
# File 'lib/prss/watcher.rb', line 3 def initialize(feed) @feed = feed end |
Instance Method Details
#start(interval, output) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/prss/watcher.rb', line 7 def start(interval, output) loop = Thread.new do loop do @feed.download_to(output) sleep(interval) end end Kernel.trap( "INT" ) { loop.exit } loop.join end |