CurlDownloadStrategy: initialize attributes in initializer

The downloader is instantiated on-demand, so we no longer need the lazy
initialization here.
This commit is contained in:
Jack Nagel 2014-12-05 22:11:23 -05:00
parent d157301cdc
commit 566d6b3a46

View File

@ -73,16 +73,13 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
end end
class CurlDownloadStrategy < AbstractDownloadStrategy class CurlDownloadStrategy < AbstractDownloadStrategy
def mirrors attr_reader :mirrors, :tarball_path, :temporary_path
@mirrors ||= resource.mirrors.dup
end
def tarball_path def initialize(name, resource)
@tarball_path ||= Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{resource.version}#{ext}") super
end @mirrors = resource.mirrors.dup
@tarball_path = HOMEBREW_CACHE.join("#{name}-#{resource.version}#{ext}")
def temporary_path @temporary_path = Pathname.new("#{tarball_path}.incomplete")
@temporary_path ||= Pathname.new("#{tarball_path}.incomplete")
end end
def cached_location def cached_location