doctor: use respond_to? instead of NoMethodError

Closes Homebrew/homebrew#47715.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
This commit is contained in:
Baptiste Fontaine 2016-01-05 15:53:57 +01:00
parent 88535b09b7
commit 0472b3f340

View File

@ -21,13 +21,13 @@ module Homebrew
first_warning = true first_warning = true
methods.each do |method| methods.each do |method|
begin unless checks.respond_to?(method)
out = checks.send(method)
rescue NoMethodError
Homebrew.failed = true Homebrew.failed = true
puts "No check available by the name: #{method}" puts "No check available by the name: #{method}"
next next
end end
out = checks.send(method)
unless out.nil? || out.empty? unless out.nil? || out.empty?
if first_warning if first_warning
$stderr.puts <<-EOS.undent $stderr.puts <<-EOS.undent