missing: simplify code a bit

This commit is contained in:
Alyssa Ross 2016-09-30 14:14:14 +01:00
parent 8e3e8e31c2
commit c88b67f3a8

View File

@ -8,6 +8,8 @@ require "utils/shell"
module Homebrew module Homebrew
module Diagnostic module Diagnostic
def self.missing_deps(ff, hide = nil) def self.missing_deps(ff, hide = nil)
hide ||= []
missing = {} missing = {}
ff.each do |f| ff.each do |f|
missing_deps = f.recursive_dependencies do |dependent, dep| missing_deps = f.recursive_dependencies do |dependent, dep|
@ -20,12 +22,8 @@ module Homebrew
end end
missing_deps.map!(&:to_formula) missing_deps.map!(&:to_formula)
if hide missing_deps.reject! do |d|
missing_deps.reject! do |d| !hide.include?(d.name) && d.installed_prefixes.any?
!hide.include?(d.name) && d.installed_prefixes.any?
end
else
missing_deps.reject! { |d| d.installed_prefixes.any? }
end end
unless missing_deps.empty? unless missing_deps.empty?