Class: Brrr::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/brrr/item.rb,
lib/brrr/item/guid.rb,
lib/brrr/item/source.rb,
lib/brrr/item/enclosure.rb

Defined Under Namespace

Classes: Enclosure, Guid, Source

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel, node) ⇒ Item

Returns a new instance of Item.



6
7
8
9
# File 'lib/brrr/item.rb', line 6

def initialize(channel, node)
  self.channel = channel
  self.node = node
end

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



3
4
5
# File 'lib/brrr/item.rb', line 3

def channel
  @channel
end

#node=(value) ⇒ Object

Sets the attribute node

Parameters:

  • value

    the value to set the attribute node to.



4
5
6
# File 'lib/brrr/item.rb', line 4

def node=(value)
  @node = value
end

Instance Method Details

#authorObject



23
24
25
# File 'lib/brrr/item.rb', line 23

def author
  @author ||= node.at_xpath("./author")&.content
end

#categoriesObject



43
44
45
# File 'lib/brrr/item.rb', line 43

def categories
  @categories ||= item_categories
end

#commentsObject



27
28
29
# File 'lib/brrr/item.rb', line 27

def comments
  @comments ||= node.at_xpath("./comments")&.content
end

#descriptionObject



19
20
21
# File 'lib/brrr/item.rb', line 19

def description
  @description ||= node.at_xpath("./description")&.content
end

#enclosureObject



47
48
49
# File 'lib/brrr/item.rb', line 47

def enclosure
  @enclosure ||= Item::Enclosure.new(node)
end

#guidObject



35
36
37
# File 'lib/brrr/item.rb', line 35

def guid
  @guid ||= Item::Guid.new(node)
end


15
16
17
# File 'lib/brrr/item.rb', line 15

def link
  @link ||= node.at_xpath("./link")&.content
end

#pub_dateObject



31
32
33
# File 'lib/brrr/item.rb', line 31

def pub_date
  @pub_date ||= parsed_pub_date
end

#sourceObject



39
40
41
# File 'lib/brrr/item.rb', line 39

def source
  @source ||= Item::Source.new(node)
end

#titleObject



11
12
13
# File 'lib/brrr/item.rb', line 11

def title
  @title ||= node.at_xpath("./title")&.content
end