Class: WordpRSS::Feed

Inherits:
Object
  • Object
show all
Defined in:
lib/wordprss/feed.rb

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ Feed

Returns a new instance of Feed.



6
7
8
# File 'lib/wordprss/feed.rb', line 6

def initialize(body)
  @body = body
end

Instance Method Details

#descriptionString

Returns the RSS feed description

Returns:

  • (String)


20
21
22
# File 'lib/wordprss/feed.rb', line 20

def description
  xml.xpath("//channel").at("description").text
end

#itemsArray<WordpRSS::Item>

Returns a collection of the RSS feed items

Returns:



27
28
29
30
31
# File 'lib/wordprss/feed.rb', line 27

def items
  xml.css("item").map do |node|
    ::WordpRSS::Item.new(node)
  end
end

#titleString

Returns the RSS feed title

Returns:

  • (String)


13
14
15
# File 'lib/wordprss/feed.rb', line 13

def title
  xml.xpath("//channel").at("title").text
end