Skip to content
Snippets Groups Projects
Commit 05a84c5a authored by Markus Reiter's avatar Markus Reiter
Browse files

Explicitly specify `block` argument for `each` methods.

parent cc3eceb0
No related branches found
No related tags found
No related merge requests found
......@@ -18,11 +18,11 @@ module 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
......
......@@ -1459,9 +1459,9 @@ class Formula
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}"
......
......@@ -552,14 +552,14 @@ class Tap
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment