Skip to content

Commit

Permalink
Remove workarounds for destructuring single-element hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
jacknagel committed Jun 20, 2015
1 parent ec1727a commit 7c83e3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/compilers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def self.for_standard standard
def self.create(spec, &block)
# Non-Apple compilers are in the format fails_with compiler => version
if spec.is_a?(Hash)
_, major_version = spec.each { |e| break e }
_, major_version = spec.first
name = "gcc-#{major_version}"
# so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible
version = "#{major_version}.999"
Expand Down
10 changes: 1 addition & 9 deletions Library/Homebrew/dependency_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,12 @@ def cache_key(spec)
end

def build(spec)
spec, tags = case spec
when Hash then destructure_spec_hash(spec)
else spec
end

spec, tags = Hash === spec ? spec.first : spec
parse_spec(spec, Array(tags))
end

private

def destructure_spec_hash(spec)
spec.each { |o| return o }
end

def parse_spec(spec, tags)
case spec
when String
Expand Down

0 comments on commit 7c83e3f

Please sign in to comment.