class RSSable::Parsers::Items::Base

Attributes

node[R]

Public Class Methods

new(node) click to toggle source
# File lib/rssable/parsers/items/base.rb, line 5
def initialize(node)
  @node = node
end

Public Instance Methods

author() click to toggle source

Returns the article author

@return [String]

# File lib/rssable/parsers/items/base.rb, line 47
def author
  node_text(node.at("author"))
end
comments_count() click to toggle source

Returns nil by the default

@return [NilClass]

# File lib/rssable/parsers/items/base.rb, line 54
def comments_count; end
description() click to toggle source

Returns the item description

@return [String]

# File lib/rssable/parsers/items/base.rb, line 33
def description
  node_text(node.at("description"))
end
published_at() click to toggle source

Returns the item publication date

@return [String]

# File lib/rssable/parsers/items/base.rb, line 26
def published_at
  node_text(node.at("pubDate"))
end
tags() click to toggle source

Returns an array of the item categories

@return [Array<String>]

# File lib/rssable/parsers/items/base.rb, line 40
def tags
  node.css("category").map(&:text)
end
title() click to toggle source

Returns the item title

@return [String]

# File lib/rssable/parsers/items/base.rb, line 12
def title
  node_text(node.at("title"))
end

Private Instance Methods

node_text(node) click to toggle source
# File lib/rssable/parsers/items/base.rb, line 60
def node_text(node)
  node.text unless node.nil?
end