Class: Yarss::Feed
- Inherits:
-
Object
- Object
- Yarss::Feed
- Defined in:
- lib/yarss/feed.rb
Overview
Feed data holder.
Instance Attribute Summary collapse
-
#description ⇒ String
Description.
-
#items ⇒ Array<Item>
Feed items.
-
#link ⇒ String
URL to the related Web page.
-
#title ⇒ String
Title.
Instance Method Summary collapse
-
#==(other) ⇒ Bool
Treat this class as a value object.
-
#description? ⇒ Bool
Is the description present?.
-
#initialize(attributes = nil) ⇒ Feed
constructor
A new instance of Feed.
-
#items? ⇒ Bool
Are the feed items present?.
-
#link? ⇒ Bool
Is the URL to the related Web page present?.
-
#title? ⇒ Bool
Is the title present?.
Constructor Details
#initialize(attributes = nil) ⇒ Feed
Returns a new instance of Feed.
27 28 29 30 31 32 |
# File 'lib/yarss/feed.rb', line 27 def initialize(attributes = nil) attributes.each do |attribute, value| setter = "#{attribute}=" send(setter, value) end if attributes end |
Instance Attribute Details
#description ⇒ String
Description.
19 20 21 |
# File 'lib/yarss/feed.rb', line 19 def description @description end |
#link ⇒ String
URL to the related Web page.
14 15 16 |
# File 'lib/yarss/feed.rb', line 14 def link @link end |
#title ⇒ String
Title.
9 10 11 |
# File 'lib/yarss/feed.rb', line 9 def title @title end |
Instance Method Details
#==(other) ⇒ Bool
Treat this class as a value object.
39 40 41 42 43 44 45 46 |
# File 'lib/yarss/feed.rb', line 39 def ==(other) return false unless other.is_a?(self.class) title == other.title && link == other.link && description == other.description && items == other.items end |
#description? ⇒ Bool
Is the description present?
65 66 67 |
# File 'lib/yarss/feed.rb', line 65 def description? !description.nil? && !description.empty? end |
#items? ⇒ Bool
Are the feed items present?
72 73 74 |
# File 'lib/yarss/feed.rb', line 72 def items? !items.nil? && !items.empty? end |
#link? ⇒ Bool
Is the URL to the related Web page present?
58 59 60 |
# File 'lib/yarss/feed.rb', line 58 def link? !link.nil? && !link.empty? end |
#title? ⇒ Bool
Is the title present?
51 52 53 |
# File 'lib/yarss/feed.rb', line 51 def title? !title.nil? && !title.empty? end |