Class: TvDotCom::Episode
- Inherits:
-
Object
- Object
- TvDotCom::Episode
- Defined in:
- lib/tv_dot_com.rb
Instance Attribute Summary collapse
-
#season ⇒ Object
readonly
Returns the value of attribute season.
-
#show ⇒ Object
readonly
Returns the value of attribute show.
Instance Method Summary collapse
- #first_aired ⇒ Object
-
#initialize(show, season, raw_html) ⇒ Episode
constructor
A new instance of Episode.
- #number ⇒ Object
- #production_number ⇒ Object
- #season_number ⇒ Object
- #title ⇒ Object
- #title_link_elem ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(show, season, raw_html) ⇒ Episode
Returns a new instance of Episode.
105 106 107 108 109 |
# File 'lib/tv_dot_com.rb', line 105 def initialize(show, season, raw_html) @show = show @season = season @raw_html = raw_html end |
Instance Attribute Details
#season ⇒ Object (readonly)
Returns the value of attribute season.
103 104 105 |
# File 'lib/tv_dot_com.rb', line 103 def season @season end |
#show ⇒ Object (readonly)
Returns the value of attribute show.
103 104 105 |
# File 'lib/tv_dot_com.rb', line 103 def show @show end |
Instance Method Details
#first_aired ⇒ Object
131 132 133 |
# File 'lib/tv_dot_com.rb', line 131 def first_aired Date.parse((@raw_html/"td[@class='ta-c']:empty").inner_html.match(/\d+\/\d+\/\d+/)[0]) end |
#number ⇒ Object
115 116 117 |
# File 'lib/tv_dot_com.rb', line 115 def number (@raw_html/"td[@class='first f-bold ta-c']").inner_html.match(/\s*(\S*)\s*/)[1] end |
#production_number ⇒ Object
119 120 121 |
# File 'lib/tv_dot_com.rb', line 119 def production_number (@raw_html/"td[@class='f-666 f-11 ta-c']").inner_html.match(/\s*(\S*)\s*/)[1] end |
#season_number ⇒ Object
123 124 125 |
# File 'lib/tv_dot_com.rb', line 123 def season_number @season.number end |
#title ⇒ Object
111 112 113 |
# File 'lib/tv_dot_com.rb', line 111 def title title_link_elem.inner_html end |
#title_link_elem ⇒ Object
135 136 137 |
# File 'lib/tv_dot_com.rb', line 135 def title_link_elem (@raw_html/"a[@href*=summary]").first end |
#url ⇒ Object
127 128 129 |
# File 'lib/tv_dot_com.rb', line 127 def url title_link_elem.attributes["href"] end |