diff --git a/Library/Homebrew/cask/cmd/doctor.rb b/Library/Homebrew/cask/cmd/doctor.rb index edd1ac9e77..5940e5da39 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 8b13751fae..0fda62b902 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 724491e01b..07cc31eb1d 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 2bb9c488fe..7439bf20fe 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 ea3e1ab8ad..f4bff47a84 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 6a09581da0..94b3ede042 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 616efd4a8b..5d0e58b3f2 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