aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/download_strategy.rb
diff options
context:
space:
mode:
authorJack Nagel2014-02-14 15:31:29 -0500
committerJack Nagel2014-02-14 15:33:37 -0500
commitd894703150acaddeac00e1827c4c76475f1aecda (patch)
tree57cd7a829e3153aeb267d969582a6c6a17f86d00 /Library/Homebrew/download_strategy.rb
parent3d3ff997c51b50742a1fa55d1bbb8045d67d4fea (diff)
downloadhomebrew-d894703150acaddeac00e1827c4c76475f1aecda.tar.bz2
VCSDownloadStrategy: use REF_TYPES when extracting ref to use
Diffstat (limited to 'Library/Homebrew/download_strategy.rb')
-rw-r--r--Library/Homebrew/download_strategy.rb7
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)