Prefer public_send to send

This commit is contained in:
Carlo Cabrera 2023-04-07 01:47:11 +08:00
parent f9cc563e91
commit 5ecd24ba20
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0
2 changed files with 7 additions and 7 deletions

View File

@ -204,8 +204,8 @@ class GitHubRunnerMatrix
arch = runner.arch arch = runner.arch
macos_version = runner.macos_version macos_version = runner.macos_version
compatible_formulae.select! { |formula| formula.send(:"#{platform}_compatible?") } compatible_formulae.select! { |formula| formula.public_send(:"#{platform}_compatible?") }
compatible_formulae.select! { |formula| formula.send(:"#{arch}_compatible?") } compatible_formulae.select! { |formula| formula.public_send(:"#{arch}_compatible?") }
compatible_formulae.select! { |formula| formula.compatible_with?(macos_version) } if macos_version compatible_formulae.select! { |formula| formula.compatible_with?(macos_version) } if macos_version
compatible_formulae.present? compatible_formulae.present?
@ -221,15 +221,15 @@ class GitHubRunnerMatrix
@testing_formulae.any? do |formula| @testing_formulae.any? do |formula|
# If the formula has a platform/arch/macOS version requirement, then its # If the formula has a platform/arch/macOS version requirement, then its
# dependents don't need to be tested if these requirements are not satisfied. # dependents don't need to be tested if these requirements are not satisfied.
next false unless formula.send(:"#{platform}_compatible?") next false unless formula.public_send(:"#{platform}_compatible?")
next false unless formula.send(:"#{arch}_compatible?") next false unless formula.public_send(:"#{arch}_compatible?")
next false if macos_version.present? && !formula.compatible_with?(macos_version) next false if macos_version.present? && !formula.compatible_with?(macos_version)
compatible_dependents = formula.dependents(platform: platform, arch: arch, macos_version: macos_version&.to_sym) compatible_dependents = formula.dependents(platform: platform, arch: arch, macos_version: macos_version&.to_sym)
.dup .dup
compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{platform}_compatible?") } compatible_dependents.select! { |dependent_f| dependent_f.public_send(:"#{platform}_compatible?") }
compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{arch}_compatible?") } compatible_dependents.select! { |dependent_f| dependent_f.public_send(:"#{arch}_compatible?") }
compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(macos_version) } if macos_version compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(macos_version) } if macos_version
# These arrays will generally have been generated by different Formulary caches, # These arrays will generally have been generated by different Formulary caches,

View File

@ -104,7 +104,7 @@ class TestRunnerFormula
Homebrew::SimulateSystem.arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch) Homebrew::SimulateSystem.arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch)
Homebrew::SimulateSystem.os = macos_version || platform Homebrew::SimulateSystem.os = macos_version || platform
Formula.send(formula_selector) Formula.public_send(formula_selector)
.select { |candidate_f| candidate_f.deps.map(&:name).include?(name) } .select { |candidate_f| candidate_f.deps.map(&:name).include?(name) }
.map { |f| TestRunnerFormula.new(f, eval_all: all) } .map { |f| TestRunnerFormula.new(f, eval_all: all) }
.freeze .freeze