Class: Tapas::Episode
- Inherits:
-
Struct
- Object
- Struct
- Tapas::Episode
- Includes:
- Comparable
- Defined in:
- lib/tapas/episode.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#number ⇒ Object
Returns the value of attribute number.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #description_matches?(text) ⇒ Boolean
- #title_matches?(text) ⇒ Boolean
- #to_s ⇒ Object
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
2 3 4 |
# File 'lib/tapas/episode.rb', line 2 def description @description end |
#number ⇒ Object
Returns the value of attribute number
2 3 4 |
# File 'lib/tapas/episode.rb', line 2 def number @number end |
#title ⇒ Object
Returns the value of attribute title
2 3 4 |
# File 'lib/tapas/episode.rb', line 2 def title @title end |
#url ⇒ Object
Returns the value of attribute url
2 3 4 |
# File 'lib/tapas/episode.rb', line 2 def url @url end |
Instance Method Details
#<=>(other) ⇒ Object
13 14 15 |
# File 'lib/tapas/episode.rb', line 13 def <=>(other) [number.to_i, title] <=> [other.number.to_i, other.title] end |
#description_matches?(text) ⇒ Boolean
9 10 11 |
# File 'lib/tapas/episode.rb', line 9 def description_matches?(text) description.downcase.include?(text.downcase) end |
#title_matches?(text) ⇒ Boolean
5 6 7 |
# File 'lib/tapas/episode.rb', line 5 def title_matches?(text) title.downcase.include?(text.downcase) end |
#to_s ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/tapas/episode.rb', line 17 def to_s if number "%3d - %s" % [ number, title ] else " %s" % title end end |