Class: SeriesTimer::Episode
- Inherits:
-
Struct
- Object
- Struct
- SeriesTimer::Episode
- Defined in:
- lib/series_timer/episode.rb
Instance Attribute Summary collapse
-
#date_raw ⇒ Object
Returns the value of attribute date_raw.
-
#number_raw ⇒ Object
Returns the value of attribute number_raw.
-
#season ⇒ Object
Returns the value of attribute season.
-
#serie ⇒ Object
Returns the value of attribute serie.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
Instance Attribute Details
#date_raw ⇒ Object
Returns the value of attribute date_raw
2 3 4 |
# File 'lib/series_timer/episode.rb', line 2 def date_raw @date_raw end |
#number_raw ⇒ Object
Returns the value of attribute number_raw
2 3 4 |
# File 'lib/series_timer/episode.rb', line 2 def number_raw @number_raw end |
#season ⇒ Object
Returns the value of attribute season
2 3 4 |
# File 'lib/series_timer/episode.rb', line 2 def season @season end |
#serie ⇒ Object
Returns the value of attribute serie
2 3 4 |
# File 'lib/series_timer/episode.rb', line 2 def serie @serie end |
#title ⇒ Object
Returns the value of attribute title
2 3 4 |
# File 'lib/series_timer/episode.rb', line 2 def title @title end |
Instance Method Details
#date ⇒ Object
4 5 6 |
# File 'lib/series_timer/episode.rb', line 4 def date @date ||= Date.parse date_raw end |
#diffdays ⇒ Object
8 9 10 11 |
# File 'lib/series_timer/episode.rb', line 8 def diffdays days = (date - Date.today).to_i "#{days.abs} days#{days < 0 ? ' ago':''}" end |
#empty? ⇒ Boolean
17 18 19 |
# File 'lib/series_timer/episode.rb', line 17 def empty? number_raw.nil? end |
#number ⇒ Object
13 14 15 |
# File 'lib/series_timer/episode.rb', line 13 def number @number ||= number_raw.to_i end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/series_timer/episode.rb', line 21 def to_s "[#{serie}] S%02dE%02d\t #{title}\t #{date} (#{diffdays})" % [ season, number ] end |