Module: Herald::Watcher::Rss

Defined in:
lib/herald/watchers/rss.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#urisObject

Returns the value of attribute uris.



6
7
8
# File 'lib/herald/watchers/rss.rb', line 6

def uris
  @uris
end

Class Method Details

.included(base) ⇒ Object

lazy-load open-uri when this Module is used



9
10
11
12
# File 'lib/herald/watchers/rss.rb', line 9

def self.included(base)
  Herald.lazy_load('open-uri')
  Herald.lazy_load('crack')
end

Instance Method Details

#cleanupObject



23
# File 'lib/herald/watchers/rss.rb', line 23

def cleanup; end

#parse_options(options) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/herald/watchers/rss.rb', line 14

def parse_options(options)
  @uris = Array(options.delete(:from))
  if @uris.empty?
    raise ArgumentError, "RSS source not specified in :from Hash"
  end
  @uris.map!{ |uri| URI.escape(uri) }
end

#prepareObject



22
# File 'lib/herald/watchers/rss.rb', line 22

def prepare; end

#to_sObject



25
26
27
# File 'lib/herald/watchers/rss.rb', line 25

def to_s
  "Herald RSS Watcher, URIs: #{@uris}, Keywords: '#{@keywords}', Timer: #{@timer}, State: #{@keep_alive ? 'Watching' : 'Stopped'}"
end