From 5ecd24ba20295a350d526d8015af8dd93273f50b Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 7 Apr 2023 01:47:11 +0800 Subject: [PATCH] Prefer `public_send` to `send` --- Library/Homebrew/github_runner_matrix.rb | 12 ++++++------ Library/Homebrew/test_runner_formula.rb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/github_runner_matrix.rb b/Library/Homebrew/github_runner_matrix.rb index 72204791d0..f01f9c0f6b 100644 --- a/Library/Homebrew/github_runner_matrix.rb +++ b/Library/Homebrew/github_runner_matrix.rb @@ -204,8 +204,8 @@ class GitHubRunnerMatrix arch = runner.arch macos_version = runner.macos_version - compatible_formulae.select! { |formula| formula.send(:"#{platform}_compatible?") } - compatible_formulae.select! { |formula| formula.send(:"#{arch}_compatible?") } + compatible_formulae.select! { |formula| formula.public_send(:"#{platform}_compatible?") } + compatible_formulae.select! { |formula| formula.public_send(:"#{arch}_compatible?") } compatible_formulae.select! { |formula| formula.compatible_with?(macos_version) } if macos_version compatible_formulae.present? @@ -221,15 +221,15 @@ class GitHubRunnerMatrix @testing_formulae.any? do |formula| # 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. - next false unless formula.send(:"#{platform}_compatible?") - next false unless formula.send(:"#{arch}_compatible?") + next false unless formula.public_send(:"#{platform}_compatible?") + next false unless formula.public_send(:"#{arch}_compatible?") 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) .dup - compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{platform}_compatible?") } - compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{arch}_compatible?") } + compatible_dependents.select! { |dependent_f| dependent_f.public_send(:"#{platform}_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 # These arrays will generally have been generated by different Formulary caches, diff --git a/Library/Homebrew/test_runner_formula.rb b/Library/Homebrew/test_runner_formula.rb index f623b4f13d..b3e2dded65 100644 --- a/Library/Homebrew/test_runner_formula.rb +++ b/Library/Homebrew/test_runner_formula.rb @@ -104,7 +104,7 @@ class TestRunnerFormula Homebrew::SimulateSystem.arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch) 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) } .map { |f| TestRunnerFormula.new(f, eval_all: all) } .freeze