class P3::Eztv::Episode

Attributes

episode_number[RW]
raw_title[RW]
season[RW]

Public Class Methods

new(episode_node) click to toggle source
# File lib/p3-eztv.rb, line 104
def initialize(episode_node)
    set_season_and_episode_number(episode_node)
    set_links(episode_node)
end

Public Instance Methods

eql?(other) click to toggle source
# File lib/p3-eztv.rb, line 113
def eql?(other)
    other.hash == self.hash
end
hash() click to toggle source
# File lib/p3-eztv.rb, line 117
def hash
    [episode_number, season].hash
end
s01e01_format() click to toggle source
# File lib/p3-eztv.rb, line 109
def s01e01_format
    @s01e01_format ||= "S#{season.to_s.rjust(2,'0')}E#{episode_number.to_s.rjust(2,'0')}"
end

Private Instance Methods

set_season_and_episode_number(episode_node) click to toggle source
# File lib/p3-eztv.rb, line 123
def set_season_and_episode_number(episode_node)
    @raw_title = episode_node.css('td.forum_thread_post a.epinfo').first.inner_text
    season_episode_match_data = @raw_title.match( /#{SE_FORMAT}/ ) || @raw_title.match( /#{X_FORMAT}/ )
    raise "no match" unless season_episode_match_data
    @season = season_episode_match_data[1].to_i
    @episode_number = season_episode_match_data[2].to_i
end