Class: Yarss::Feed

Inherits:
Object
  • Object
show all
Defined in:
lib/yarss/feed.rb

Overview

Feed data holder.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = nil) ⇒ Feed

Returns a new instance of Feed.

Parameters:

  • attributes (Hash, nil) (defaults to: nil)

    Data to set.



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

#descriptionString

Description.

Returns:

  • (String)


19
20
21
# File 'lib/yarss/feed.rb', line 19

def description
  @description
end

#itemsArray<Item>

Feed items.

Returns:



24
25
26
# File 'lib/yarss/feed.rb', line 24

def items
  @items
end

URL to the related Web page.

Returns:

  • (String)


14
15
16
# File 'lib/yarss/feed.rb', line 14

def link
  @link
end

#titleString

Title.

Returns:

  • (String)


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.

Parameters:

Returns:

  • (Bool)


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