Class: TvDotCom::Season

Inherits:
Object
  • Object
show all
Defined in:
lib/tv_dot_com.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#numberObject (readonly)

Returns the value of attribute number.



79
80
81
# File 'lib/tv_dot_com.rb', line 79

def number
  @number
end

#showObject (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_listObject



86
87
88
# File 'lib/tv_dot_com.rb', line 86

def episode_list
  @episode_list ||= Hpricot(open(show.episode_list_url(number)))
end

#episodesObject



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_episodesObject



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