Class: Imdb::Episode

Inherits:
Base
  • Object
show all
Defined in:
lib/imdb/episode.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#also_known_as, #id, #title, #url

Instance Method Summary collapse

Methods inherited from Base

#cast_characters, #cast_member_ids, #cast_members, #cast_members_characters, #company, #countries, #director, #filming_locations, #genres, #languages, #length, #mpaa_rating, #plot, #plot_summary, #plot_synopsis, #poster, #rating, #release_date, #tagline, #trailer_url, #votes, #year

Constructor Details

#initialize(imdb_id, season, episode, episode_title) ⇒ Episode

Returns a new instance of Episode.



5
6
7
8
9
10
# File 'lib/imdb/episode.rb', line 5

def initialize(imdb_id, season, episode, episode_title)
  super(imdb_id, episode_title)
  @url = "http://akas.imdb.com/title/tt#{imdb_id}/combined"
  @season = season
  @episode = episode
end

Instance Attribute Details

#episodeObject

Returns the value of attribute episode.



3
4
5
# File 'lib/imdb/episode.rb', line 3

def episode
  @episode
end

#episode_titleObject

Returns the value of attribute episode_title.



3
4
5
# File 'lib/imdb/episode.rb', line 3

def episode_title
  @episode_title
end

#seasonObject

Returns the value of attribute season.



3
4
5
# File 'lib/imdb/episode.rb', line 3

def season
  @season
end

Instance Method Details

#air_dateObject

Return the original air date for this episode



13
14
15
# File 'lib/imdb/episode.rb', line 13

def air_date
  document.at("h5[text()*='Original Air Date'] ~ div").content.strip.split("\n").first.strip rescue nil
end