diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index 616a7bff43..b209511a94 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -26,7 +26,7 @@ module Cask return to_enum unless block Tap.flat_map(&:cask_files).each do |f| - block.call CaskLoader::FromTapPathLoader.new(f).load(config: nil) + yield CaskLoader::FromTapPathLoader.new(f).load(config: nil) rescue CaskUnreadableError => e opoo e.message end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index b9e05f3b0b..58f3d9af86 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1674,9 +1674,9 @@ class Formula end # @private - def self.each(&block) + def self.each(&_block) files.each do |file| - block.call Formulary.factory(file) + yield Formulary.factory(file) rescue FormulaUnavailableError, FormulaUnreadableError => e # Don't let one broken formula break commands. But do complain. onoe "Failed to import: #{file}" diff --git a/Library/Homebrew/livecheck/strategy/electron_builder.rb b/Library/Homebrew/livecheck/strategy/electron_builder.rb index 267fce0c74..01561078e2 100644 --- a/Library/Homebrew/livecheck/strategy/electron_builder.rb +++ b/Library/Homebrew/livecheck/strategy/electron_builder.rb @@ -50,7 +50,7 @@ module Homebrew yaml = YAML.safe_load(content) return [] if yaml.blank? - return Strategy.handle_block_return(block.call(yaml)) if block + return Strategy.handle_block_return(yield(yaml)) if block version = yaml["version"] version.present? ? [version] : [] diff --git a/Library/Homebrew/livecheck/strategy/extract_plist.rb b/Library/Homebrew/livecheck/strategy/extract_plist.rb index 51a9419cb2..4053ab9bef 100644 --- a/Library/Homebrew/livecheck/strategy/extract_plist.rb +++ b/Library/Homebrew/livecheck/strategy/extract_plist.rb @@ -68,7 +68,7 @@ module Homebrew ).returns(T::Array[String]) } def self.versions_from_items(items, &block) - return Strategy.handle_block_return(block.call(items)) if block + return Strategy.handle_block_return(yield(items)) if block items.map do |_key, item| item.bundle_version.nice_version diff --git a/Library/Homebrew/livecheck/strategy/git.rb b/Library/Homebrew/livecheck/strategy/git.rb index d7078b7cd1..402701d72c 100644 --- a/Library/Homebrew/livecheck/strategy/git.rb +++ b/Library/Homebrew/livecheck/strategy/git.rb @@ -93,7 +93,7 @@ module Homebrew ).returns(T::Array[String]) } def self.versions_from_tags(tags, regex = nil, &block) - return Strategy.handle_block_return(block.call(tags, regex || DEFAULT_REGEX)) if block + return Strategy.handle_block_return(yield(tags, regex || DEFAULT_REGEX)) if block tags_only_debian = tags.all? { |tag| tag.start_with?("debian/") } diff --git a/Library/Homebrew/livecheck/strategy/header_match.rb b/Library/Homebrew/livecheck/strategy/header_match.rb index d1d7ff90ea..6d397f8402 100644 --- a/Library/Homebrew/livecheck/strategy/header_match.rb +++ b/Library/Homebrew/livecheck/strategy/header_match.rb @@ -53,7 +53,7 @@ module Homebrew ).returns(T::Array[String]) } def self.versions_from_headers(headers, regex = nil, &block) - return Strategy.handle_block_return(block.call(headers, regex)) if block + return Strategy.handle_block_return(yield(headers, regex)) if block DEFAULT_HEADERS_TO_CHECK.map do |header_name| header_value = headers[header_name] diff --git a/Library/Homebrew/livecheck/strategy/page_match.rb b/Library/Homebrew/livecheck/strategy/page_match.rb index de5094821f..6b588b9be9 100644 --- a/Library/Homebrew/livecheck/strategy/page_match.rb +++ b/Library/Homebrew/livecheck/strategy/page_match.rb @@ -57,7 +57,7 @@ module Homebrew ).returns(T::Array[String]) } def self.versions_from_content(content, regex, &block) - return Strategy.handle_block_return(block.call(content, regex)) if block + return Strategy.handle_block_return(yield(content, regex)) if block return [] if regex.blank? content.scan(regex).map do |match| diff --git a/Library/Homebrew/livecheck/strategy/sparkle.rb b/Library/Homebrew/livecheck/strategy/sparkle.rb index 603243d3fd..b98d196c6b 100644 --- a/Library/Homebrew/livecheck/strategy/sparkle.rb +++ b/Library/Homebrew/livecheck/strategy/sparkle.rb @@ -157,7 +157,7 @@ module Homebrew item = item_from_content(content) return [] if item.blank? - return Strategy.handle_block_return(block.call(item)) if block + return Strategy.handle_block_return(yield(item)) if block version = item.bundle_version&.nice_version version.present? ? [version] : [] diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 671272713f..0a5315a987 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -659,7 +659,7 @@ class Tap TAP_DIRECTORY.subdirs.each do |user| user.subdirs.each do |repo| - block.call fetch(user.basename.to_s, repo.basename.to_s) + yield fetch(user.basename.to_s, repo.basename.to_s) end end end