Skip to content

Commit

Permalink
Explicitly specify block argument for each methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Sep 19, 2020
1 parent cc3eceb commit 05a84c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Library/Homebrew/cask/cask.rb
Expand Up @@ -18,11 +18,11 @@ class Cask

attr_reader :token, :sourcefile_path, :config

def self.each
def self.each(&block)
return to_enum unless block_given?

Tap.flat_map(&:cask_files).each do |f|
yield CaskLoader::FromTapPathLoader.new(f).load
block.call CaskLoader::FromTapPathLoader.new(f).load
rescue CaskUnreadableError => e
opoo e.message
end
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/formula.rb
Expand Up @@ -1459,9 +1459,9 @@ def self.full_names
end

# @private
def self.each
def self.each(&block)
files.each do |file|
yield Formulary.factory(file)
block.call Formulary.factory(file)
rescue FormulaUnavailableError, FormulaUnreadableError => e
# Don't let one broken formula break commands. But do complain.
onoe "Failed to import: #{file}"
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/tap.rb
Expand Up @@ -552,14 +552,14 @@ def ==(other)
self.class == other.class && name == other.name
end

def self.each
def self.each(&block)
return unless TAP_DIRECTORY.directory?

return to_enum unless block_given?

TAP_DIRECTORY.subdirs.each do |user|
user.subdirs.each do |repo|
yield fetch(user.basename.to_s, repo.basename.to_s)
block.call fetch(user.basename.to_s, repo.basename.to_s)
end
end
end
Expand Down

0 comments on commit 05a84c5

Please sign in to comment.