class RSSable::Parsers::Channel

Attributes

driver[R]
feed[R]

Public Class Methods

new(feed:, driver:) click to toggle source
# File lib/rssable/parsers/channel.rb, line 5
def initialize(feed:, driver:)
  @feed = feed
  @driver = driver
end

Public Instance Methods

description() click to toggle source

Returns the RSS feed description

@return [String]

# File lib/rssable/parsers/channel.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]

# File lib/rssable/parsers/channel.rb, line 34
def items
  xml.css("item").map { |node| item_class.new(node) }
end
title() click to toggle source

Returns the RSS feed title

@return [String]

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

Private Instance Methods

item_class() click to toggle source
# File lib/rssable/parsers/channel.rb, line 46
def item_class
  @item_class ||= ::RSSable::Parsers::ItemClassBuilder.call(
    driver: driver
  )
end
xml() click to toggle source
# File lib/rssable/parsers/channel.rb, line 42
def xml
  @xml ||= Nokogiri::XML(feed)
end