From 5ce4c2a3f889c331fb12483c7bd4fee3b5addf1f Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 14 Feb 2014 15:31:29 -0500 Subject: [PATCH] VCSDownloadStrategy: use REF_TYPES when extracting ref to use --- Library/Homebrew/download_strategy.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index e69a45b55c..cf9e6113d1 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)