From 566d6b3a462c740913852d889f39d6f6824d8c88 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 5 Dec 2014 22:11:23 -0500 Subject: [PATCH] CurlDownloadStrategy: initialize attributes in initializer The downloader is instantiated on-demand, so we no longer need the lazy initialization here. --- Library/Homebrew/download_strategy.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index d3b72e09aa..7d6aca1bcb 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -73,16 +73,13 @@ class VCSDownloadStrategy < AbstractDownloadStrategy end class CurlDownloadStrategy < AbstractDownloadStrategy - def mirrors - @mirrors ||= resource.mirrors.dup - end + attr_reader :mirrors, :tarball_path, :temporary_path - def tarball_path - @tarball_path ||= Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{resource.version}#{ext}") - end - - def temporary_path - @temporary_path ||= Pathname.new("#{tarball_path}.incomplete") + def initialize(name, resource) + super + @mirrors = resource.mirrors.dup + @tarball_path = HOMEBREW_CACHE.join("#{name}-#{resource.version}#{ext}") + @temporary_path = Pathname.new("#{tarball_path}.incomplete") end def cached_location