class RubyTapasDownloader::Extractors::Episode

Extract an Episode from an Feed Item.

Public Class Methods

new(files_extractor = RubyTapasDownloader::Extractors::Files.new) click to toggle source

@param files_extractor [RubyTapasDownloader::Extractors::Files] the

Files Extractor.
# File lib/ruby_tapas_downloader/extractors/episode.rb, line 5
def initialize(files_extractor = RubyTapasDownloader::Extractors::Files.new)
  @files_extractor = files_extractor
end

Public Instance Methods

extract(item) click to toggle source

@param item [RSS::Rss::Channel::Item] the feed item extracted with

`feed.items[i]`.

@return [RubyTapasDownloader::Downloadables::Episode] the Episode extracted

from feed item.
# 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