Module: RSSDetector

Defined in:
lib/rss_detector.rb

Constant Summary collapse

RSS_XPATH =

xpath for feed

'//link[@rel="alternate"][@type="application/rss+xml"]'
ATOM_XPATH =
'//link[@rel="alternate"][@type="application/atom+xml"]'

Class Method Summary collapse

Class Method Details

.detect(doc) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/rss_detector.rb', line 12

def detect(doc)
    # create html from string
    html = Nokogiri::HTML(doc)

    # detect rss and atom
    rss_feeds  = detectFeed(html, RSS_XPATH)
    atom_feeds = detectFeed(html, ATOM_XPATH)

    rss_feeds + atom_feeds
end