class WordpRSS::Feed

Attributes

body[R]

Public Class Methods

new(body) click to toggle source
# File lib/wordprss/feed.rb, line 6
def initialize(body)
  @body = body
end

Public Instance Methods

description() click to toggle source

Returns the RSS feed description

@return [String]

# File lib/wordprss/feed.rb, line 20
def description
  xml.xpath("//channel").at("description").text
end
items() click to toggle source

Returns a collection of the RSS feed items

@return [Array<WordpRSS::Item>]

# File lib/wordprss/feed.rb, line 27
def items
  xml.css("item").map do |node|
    ::WordpRSS::Item.new(node)
  end
end
title() click to toggle source

Returns the RSS feed title

@return [String]

# File lib/wordprss/feed.rb, line 13
def title
  xml.xpath("//channel").at("title").text
end

Private Instance Methods

xml() click to toggle source
# File lib/wordprss/feed.rb, line 37
def xml
  @xml ||= ::Nokogiri::XML(body)
end