Class: TvDotCom::Season
- Inherits:
-
Object
- Object
- TvDotCom::Season
- Defined in:
- lib/tv_dot_com.rb
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#show ⇒ Object
readonly
Returns the value of attribute show.
Instance Method Summary collapse
- #episode_list ⇒ Object
- #episodes ⇒ Object
-
#initialize(show, newnumber) ⇒ Season
constructor
A new instance of Season.
- #number_of_episodes ⇒ Object
Constructor Details
#initialize(show, newnumber) ⇒ Season
Returns a new instance of Season.
81 82 83 84 |
# File 'lib/tv_dot_com.rb', line 81 def initialize(show, newnumber) @show = show @number = newnumber end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
79 80 81 |
# File 'lib/tv_dot_com.rb', line 79 def number @number end |
#show ⇒ Object (readonly)
Returns the value of attribute show.
79 80 81 |
# File 'lib/tv_dot_com.rb', line 79 def show @show end |
Instance Method Details
#episode_list ⇒ Object
86 87 88 |
# File 'lib/tv_dot_com.rb', line 86 def episode_list @episode_list ||= Hpricot(open(show.episode_list_url(number))) end |
#episodes ⇒ Object
94 95 96 97 98 |
# File 'lib/tv_dot_com.rb', line 94 def episodes rows = episode_list/"div[@class='table-styled'] table tr" rows.shift rows.collect { |row| Episode.new(@show, self, row)} end |
#number_of_episodes ⇒ Object
90 91 92 |
# File 'lib/tv_dot_com.rb', line 90 def number_of_episodes (episode_list/"div[@class='table-styled'] table tr").size - 1 end |