diff options
| author | Jack Nagel | 2014-02-14 15:31:29 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-02-14 15:33:37 -0500 |
| commit | 5ce4c2a3f889c331fb12483c7bd4fee3b5addf1f (patch) | |
| tree | 39aa70e8235b049b6009d800fc7437f429f3f980 /Library | |
| parent | 41e3b2cad0d653ddbe6e88cfe875c9903972af7e (diff) | |
| download | brew-5ce4c2a3f889c331fb12483c7bd4fee3b5addf1f.tar.bz2 | |
VCSDownloadStrategy: use REF_TYPES when extracting ref to use
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index e69a45b55..cf9e6113d 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -43,12 +43,13 @@ class VCSDownloadStrategy < AbstractDownloadStrategy def initialize name, resource super - @ref_type, @ref = destructure_spec_hash(resource.specs) + @ref_type, @ref = extract_ref(resource.specs) @clone = HOMEBREW_CACHE/cache_filename end - def destructure_spec_hash(spec) - spec.each { |o| return o } + def extract_ref(specs) + key = REF_TYPES.find { |type| specs.key?(type) } + return key, specs[key] end def cache_filename(tag=cache_tag) |
