diff --git a/Library/Homebrew/cask/cmd/doctor.rb b/Library/Homebrew/cask/cmd/doctor.rb index edd1ac9e77254ef286f0cbbbb517eba843497b39..5940e5da399c4a8762a775e32bc7614509f96789 100644 --- a/Library/Homebrew/cask/cmd/doctor.rb +++ b/Library/Homebrew/cask/cmd/doctor.rb @@ -75,7 +75,7 @@ module Cask ohai "Homebrew Cask Taps:" [default_tap, *alt_taps].each do |tap| - if tap.path.nil? || tap.path.to_s.empty? + if tap.path.blank? puts none_string else puts "#{tap.path} (#{cask_count_for_tap(tap)})" diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 8b13751fae06150e2a1d3eed62e48c742073bf0b..0fda62b9022a5543c8cb8ea98042bce1f41f33d8 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -961,7 +961,7 @@ module Homebrew def audit_version if version.nil? problem "missing version" - elsif version.to_s.empty? + elsif version.blank? problem "version is set to an empty string" elsif !version.detected_from_url? version_text = version diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 724491e01bbe6c29ccb6abdb13f377a24d398571..07cc31eb1d07a7d9bbe4e59178215c402e627d39 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -453,7 +453,7 @@ module Homebrew tag = tag.to_s.delete ":" unless tag.empty? - if !bottle_hash["bottle"]["tags"][tag].to_s.empty? + if bottle_hash["bottle"]["tags"][tag].present? mismatches << "#{key} => #{tag}" else bottle.send(key, old_value => tag.to_sym) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 2bb9c488fedc932b82fcce5ed8cdeb4e2cc56210..7439bf20fe50d183bae555be3128b1729038fa0f 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -1109,7 +1109,7 @@ class BazaarDownloadStrategy < VCSDownloadStrategy def source_modified_time out, = system_command("bzr", args: ["log", "-l", "1", "--timezone=utc", cached_location]) timestamp = out.chomp - raise "Could not get any timestamps from bzr!" if timestamp.to_s.empty? + raise "Could not get any timestamps from bzr!" if timestamp.blank? Time.parse(timestamp) end diff --git a/Library/Homebrew/extend/os/linux/diagnostic.rb b/Library/Homebrew/extend/os/linux/diagnostic.rb index ea3e1ab8ad9fe764323a79c8587c55dbdee47eb8..f4bff47a84c2ab8529911367ce227d920be818eb 100644 --- a/Library/Homebrew/extend/os/linux/diagnostic.rb +++ b/Library/Homebrew/extend/os/linux/diagnostic.rb @@ -35,7 +35,7 @@ module Homebrew end def check_xdg_data_dirs - return if ENV["XDG_DATA_DIRS"].to_s.empty? + return if ENV["XDG_DATA_DIRS"].blank? return if ENV["XDG_DATA_DIRS"].split("/").include?(HOMEBREW_PREFIX/"share") <<~EOS Homebrew's share was not found in your XDG_DATA_DIRS but you have diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 6a09581da0738a39790fa4ccc2ee87f6ca642937..94b3ede042cc7a4acc48757c45bec404c7a6f9b9 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -130,6 +130,7 @@ require "extend/pathname" require "extend/module" require "extend/predicable" require "extend/string" +require "active_support/core_ext/object/blank" require "constants" require "exceptions" diff --git a/Library/Homebrew/missing_formula.rb b/Library/Homebrew/missing_formula.rb index 616efd4a8b53985366a98f2e996cba9369c468d8..5d0e58b3f25e7df38f9551c3c62f42706d4f85f0 100644 --- a/Library/Homebrew/missing_formula.rb +++ b/Library/Homebrew/missing_formula.rb @@ -142,8 +142,7 @@ module Homebrew hash, short_hash, *commit_message, relative_path = Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp) - if hash.to_s.empty? || short_hash.to_s.empty? || - relative_path.to_s.empty? + if hash.blank? || short_hash.blank? || relative_path.blank? ofail "No previously deleted formula found." unless silent return end