Class: RubyTapasDownloader::Extractors::Episode

Inherits:
RubyTapasDownloader::Extractor show all
Defined in:
lib/ruby_tapas_downloader/extractors/episode.rb

Overview

Extract an Episode from an Feed Item.

Instance Method Summary collapse

Constructor Details

#initialize(files_extractor = RubyTapasDownloader::Extractors::Files.new) ⇒ Episode

Returns a new instance of Episode.

Parameters:



5
6
7
# File 'lib/ruby_tapas_downloader/extractors/episode.rb', line 5

def initialize(files_extractor = RubyTapasDownloader::Extractors::Files.new)
  @files_extractor = files_extractor
end

Instance Method Details

#extract(item) ⇒ RubyTapasDownloader::Downloadables::Episode

Returns the Episode extracted from feed item.

Parameters:

  • item (RSS::Rss::Channel::Item)

    the feed item extracted with ‘feed.items`.

Returns:



13
14
15
16
17
18
19
# File 'lib/ruby_tapas_downloader/extractors/episode.rb', line 13

def extract(item)
  title = CGI.unescapeHTML item.title
  link  = item.link
  files = @files_extractor.extract item.description

  RubyTapasDownloader::Downloadables::Episode.new title, link, files
end