Class: Brrr::Item
- Inherits:
-
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
#channel ⇒ Object
Returns the value of attribute channel.
3
4
5
|
# File 'lib/brrr/item.rb', line 3
def channel
@channel
end
|
#node=(value) ⇒ Object
4
5
6
|
# File 'lib/brrr/item.rb', line 4
def node=(value)
@node = value
end
|
Instance Method Details
#author ⇒ Object
23
24
25
|
# File 'lib/brrr/item.rb', line 23
def author
@author ||= node.at_xpath("./author")&.content
end
|
#categories ⇒ Object
43
44
45
|
# File 'lib/brrr/item.rb', line 43
def categories
@categories ||= item_categories
end
|
27
28
29
|
# File 'lib/brrr/item.rb', line 27
def
@comments ||= node.at_xpath("./comments")&.content
end
|
#description ⇒ Object
19
20
21
|
# File 'lib/brrr/item.rb', line 19
def description
@description ||= node.at_xpath("./description")&.content
end
|
#enclosure ⇒ Object
47
48
49
|
# File 'lib/brrr/item.rb', line 47
def enclosure
@enclosure ||= Item::Enclosure.new(node)
end
|
#guid ⇒ Object
35
36
37
|
# File 'lib/brrr/item.rb', line 35
def guid
@guid ||= Item::Guid.new(node)
end
|
#link ⇒ Object
15
16
17
|
# File 'lib/brrr/item.rb', line 15
def link
@link ||= node.at_xpath("./link")&.content
end
|
#pub_date ⇒ Object
31
32
33
|
# File 'lib/brrr/item.rb', line 31
def pub_date
@pub_date ||= parsed_pub_date
end
|
#source ⇒ Object
39
40
41
|
# File 'lib/brrr/item.rb', line 39
def source
@source ||= Item::Source.new(node)
end
|
#title ⇒ Object
11
12
13
|
# File 'lib/brrr/item.rb', line 11
def title
@title ||= node.at_xpath("./title")&.content
end
|