Sha256: bb0e94c6ca6f3a27783235384ff622f7e54b051a37dffcb4e064ef6bbeceafcc

Contents?: true

Size: 436 Bytes

Versions: 2

Compression:

Stored size: 436 Bytes

Contents

module PRSS
  class Watcher
    def initialize(feed)
      @feed = feed
    end

    def start(interval, output)
      loop = Thread.new do
        loop do
          begin
            @feed.download_to(output)
          rescue PRSS::Links::InvalidXMLError
            warn 'ignoring invalid xml'
          end

          sleep(interval)
        end
      end

      Kernel.trap( "INT" ) { loop.exit }

      loop.join
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prss-0.2.4 lib/prss/watcher.rb
prss-0.2.3 lib/prss/watcher.rb