class RubyTapasDownloader::Downloadables::File

The File resource of an Episode.

Attributes

name[R]

@return [String] the name of the File.

Public Class Methods

new(name, link) click to toggle source
# File lib/ruby_tapas_downloader/downloadables/file.rb, line 11
def initialize(name, link)
  @name = name
  @link = link
end

Public Instance Methods

==(other) click to toggle source
# File lib/ruby_tapas_downloader/downloadables/file.rb, line 28
def ==(other)
  name == other.name && link == other.link
end
download(basepath, agent) click to toggle source

Download the File.

@param (see: RubyTapasDownloader::Downloadables::Catalog#download)

# File lib/ruby_tapas_downloader/downloadables/file.rb, line 19
def download(basepath, agent)
  FileUtils.mkdir_p basepath

  file_path = File.join(basepath, name)
  RubyTapasDownloader.logger.info "Starting download of file `#{ name }' " \
                                  "in `#{ file_path }'..."
  agent.download link, file_path unless File.exist? file_path
end
eql?(other) click to toggle source
# File lib/ruby_tapas_downloader/downloadables/file.rb, line 32
def eql?(other)
  name.eql?(other.name) && link.eql?(other.link)
end
hash() click to toggle source
# File lib/ruby_tapas_downloader/downloadables/file.rb, line 36
def hash
  name.hash + link.hash
end