Add key? to BottleCollector

This commit is contained in:
Jack Nagel 2014-07-16 18:54:19 -05:00
parent 197dbe5601
commit 3c366a56d7

View File

@ -69,7 +69,7 @@ class BottleCollector
end end
def fetch_checksum_for(tag) def fetch_checksum_for(tag)
return [@bottles[tag], tag] if @bottles[tag] return [@bottles[tag], tag] if key?(tag)
find_altivec_tag(tag) || find_or_later_tag(tag) find_altivec_tag(tag) || find_or_later_tag(tag)
end end
@ -86,14 +86,18 @@ class BottleCollector
@bottles[key] = value @bottles[key] = value
end end
def key?(key)
@bottles.key?(key)
end
# This allows generic Altivec PPC bottles to be supported in some # This allows generic Altivec PPC bottles to be supported in some
# formulae, while also allowing specific bottles in others; e.g., # formulae, while also allowing specific bottles in others; e.g.,
# sometimes a formula has just :tiger_altivec, other times it has # sometimes a formula has just :tiger_altivec, other times it has
# :tiger_g4, :tiger_g5, etc. # :tiger_g4, :tiger_g5, etc.
def find_altivec_tag(tag) def find_altivec_tag(tag)
if tag.to_s =~ /(\w+)_(g4|g4e|g5)$/ if tag.to_s =~ /(\w+)_(g4|g4e|g5)$/
altitag = "#{$1}_altivec".to_sym altivec_tag = "#{$1}_altivec".to_sym
return [@bottles[altitag], altitag] if @bottles[altitag] return [@bottles[altivec_tag], altivec_tag] if key?(altivec_tag)
end end
end end