Class: RSSable::Parsers::Items::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rssable/parsers/items/base.rb

Direct Known Subclasses

Blogger, Medium, Wordpress

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Base

Returns a new instance of Base.



5
6
7
# File 'lib/rssable/parsers/items/base.rb', line 5

def initialize(node)
  @node = node
end

Instance Method Details

#authorString

Returns the article author

Returns:

  • (String)


47
48
49
# File 'lib/rssable/parsers/items/base.rb', line 47

def author
  node_text(node.at("author"))
end

#comments_countNilClass

Returns nil by the default

Returns:

  • (NilClass)


54
# File 'lib/rssable/parsers/items/base.rb', line 54

def comments_count; end

#descriptionString

Returns the item description

Returns:

  • (String)


33
34
35
# File 'lib/rssable/parsers/items/base.rb', line 33

def description
  node_text(node.at("description"))
end

Returns the item link

Returns:

  • (String)


19
20
21
# File 'lib/rssable/parsers/items/base.rb', line 19

def link
  node_text(node.at("link"))
end

#published_atString

Returns the item publication date

Returns:

  • (String)


26
27
28
# File 'lib/rssable/parsers/items/base.rb', line 26

def published_at
  node_text(node.at("pubDate"))
end

#tagsArray<String>

Returns an array of the item categories

Returns:

  • (Array<String>)


40
41
42
# File 'lib/rssable/parsers/items/base.rb', line 40

def tags
  node.css("category").map(&:text)
end

#titleString

Returns the item title

Returns:

  • (String)


12
13
14
# File 'lib/rssable/parsers/items/base.rb', line 12

def title
  node_text(node.at("title"))
end