Class: Imdb::Season
- Inherits:
-
Object
- Object
- Imdb::Season
- Defined in:
- lib/imdb/season.rb
Instance Attribute Summary collapse
-
#episodes ⇒ Object
Returns the value of attribute episodes.
-
#id ⇒ Object
Returns the value of attribute id.
-
#season_number ⇒ Object
Returns the value of attribute season_number.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #episode(number) ⇒ Object
-
#initialize(url) ⇒ Season
constructor
A new instance of Season.
Constructor Details
#initialize(url) ⇒ Season
5 6 7 8 9 |
# File 'lib/imdb/season.rb', line 5 def initialize(url) @url = url @season_number = @url.scan(/episodes\?season=(\d+)/).flatten.first.to_i @episodes = [] end |
Instance Attribute Details
#episodes ⇒ Object
Returns the value of attribute episodes.
3 4 5 |
# File 'lib/imdb/season.rb', line 3 def episodes @episodes end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/imdb/season.rb', line 3 def id @id end |
#season_number ⇒ Object
Returns the value of attribute season_number.
3 4 5 |
# File 'lib/imdb/season.rb', line 3 def season_number @season_number end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/imdb/season.rb', line 3 def url @url end |
Instance Method Details
#episode(number) ⇒ Object
11 12 13 |
# File 'lib/imdb/season.rb', line 11 def episode(number) episodes.fetch(number-1, nil) end |