Class: Tvrage::Episode
- Inherits:
-
Object
- Object
- Tvrage::Episode
- Defined in:
- lib/tvrage/episode.rb
Instance Attribute Summary collapse
-
#air_date ⇒ Object
Returns the value of attribute air_date.
-
#link ⇒ Object
Returns the value of attribute link.
-
#number ⇒ Object
Returns the value of attribute number.
-
#product_number ⇒ Object
Returns the value of attribute product_number.
-
#screencap ⇒ Object
Returns the value of attribute screencap.
-
#season ⇒ Object
Returns the value of attribute season.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(data, season_number = 0) ⇒ Episode
constructor
A new instance of Episode.
Constructor Details
#initialize(data, season_number = 0) ⇒ Episode
Returns a new instance of Episode.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tvrage/episode.rb', line 7 def initialize(data, season_number = 0) @season = season_number.to_i @number = data.xpath('seasonnum').text.to_i @product_number = data.xpath('prodnum').text @link = data.xpath('link').text @title = data.xpath('title').text @screencap = data.xpath('screencap').text if !data.xpath('screencap').text.empty? begin @air_date = Date.parse(data.xpath('airdate').text) if !data.xpath('airdate').text.empty? rescue Exception => e # air date is invalid end end |
Instance Attribute Details
#air_date ⇒ Object
Returns the value of attribute air_date.
5 6 7 |
# File 'lib/tvrage/episode.rb', line 5 def air_date @air_date end |
#link ⇒ Object
Returns the value of attribute link.
5 6 7 |
# File 'lib/tvrage/episode.rb', line 5 def link @link end |
#number ⇒ Object
Returns the value of attribute number.
5 6 7 |
# File 'lib/tvrage/episode.rb', line 5 def number @number end |
#product_number ⇒ Object
Returns the value of attribute product_number.
5 6 7 |
# File 'lib/tvrage/episode.rb', line 5 def product_number @product_number end |
#screencap ⇒ Object
Returns the value of attribute screencap.
5 6 7 |
# File 'lib/tvrage/episode.rb', line 5 def screencap @screencap end |
#season ⇒ Object
Returns the value of attribute season.
5 6 7 |
# File 'lib/tvrage/episode.rb', line 5 def season @season end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/tvrage/episode.rb', line 5 def title @title end |