Class: Headline
- Inherits:
-
Object
- Object
- Headline
- Defined in:
- lib/headline.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(title, url, channel = '') ⇒ Headline
constructor
A new instance of Headline.
- #to_s ⇒ Object
Constructor Details
#initialize(title, url, channel = '') ⇒ Headline
Returns a new instance of Headline.
4 5 6 7 8 |
# File 'lib/headline.rb', line 4 def initialize(title, url, channel = '') @title = title @url = url @channel = channel end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
2 3 4 |
# File 'lib/headline.rb', line 2 def channel @channel end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
2 3 4 |
# File 'lib/headline.rb', line 2 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
2 3 4 |
# File 'lib/headline.rb', line 2 def url @url end |
Instance Method Details
#==(other) ⇒ Object
10 11 12 13 |
# File 'lib/headline.rb', line 10 def ==(other) !other.nil? && other.is_a?(Headline) && @title == other.title && @url == other.url && @channel == other.channel end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/headline.rb', line 15 def to_s "#{title} [#{url}]" end |