git grep -lE '\(\&[A-Za-z._]+method\(:' | xargs gsed -i -E 's|\(\&([A-Za-z._]+)method\(:([a-z?_]+)\)\)| { \1\2(_1) }|g'

This commit is contained in:
Douglas Eichelberger 2024-03-03 18:55:56 -08:00
parent 90996e1997
commit c4db19232d
8 changed files with 10 additions and 10 deletions

View File

@ -77,7 +77,7 @@ class PATH
sig { returns(T.nilable(T.self_type)) }
def existing
existing_path = select(&File.method(:directory?))
existing_path = select { File.directory?(_1) }
# return nil instead of empty PATH, to unset environment variables
existing_path unless existing_path.empty?
end

View File

@ -135,7 +135,7 @@ module Cask
# @api public
sig { returns(T::Array[Version]) } # Only top-level T.self_type is supported https://sorbet.org/docs/self-type
def csv
split(",").map(&self.class.method(:new))
split(",").map { self.class.new(_1) }
end
# @api public

View File

@ -664,7 +664,7 @@ on_request: installed_on_request?, options: options)
puts "All dependencies for #{formula.full_name} are satisfied."
elsif !deps.empty?
oh1 "Installing dependencies for #{formula.full_name}: " \
"#{deps.map(&:first).map(&Formatter.method(:identifier)).to_sentence}",
"#{deps.map(&:first).map { Formatter.identifier(_1) }.to_sentence}",
truncate: false
deps.each { |dep, options| install_dependency(dep, options) }
end
@ -1184,7 +1184,7 @@ on_request: installed_on_request?, options: options)
return if deps.empty?
oh1 "Fetching dependencies for #{formula.full_name}: " \
"#{deps.map(&:first).map(&Formatter.method(:identifier)).to_sentence}",
"#{deps.map(&:first).map { Formatter.identifier(_1) }.to_sentence}",
truncate: false
deps.each { |(dep, _options)| fetch_dependency(dep) }

View File

@ -143,7 +143,7 @@ class Keg
files ||= text_files | libtool_files
changed_files = T.let([], Array)
files.map(&path.method(:join)).group_by { |f| f.stat.ino }.each_value do |first, *rest|
files.map { path.join(_1) }.group_by { |f| f.stat.ino }.each_value do |first, *rest|
s = first.open("rb", &:read)
next unless relocation.replace_text(s)

View File

@ -276,7 +276,7 @@ class SystemCommand
sig { params(raw_stdin: IO).void }
def write_input_to(raw_stdin)
input.each(&raw_stdin.method(:write))
input.each { raw_stdin.write(_1) }
end
sig { params(sources: T::Array[IO], _block: T.proc.params(type: Symbol, line: String).void).void }

View File

@ -322,11 +322,11 @@ class Tab
end
def stable_version
versions["stable"]&.then(&Version.method(:new))
versions["stable"]&.then { Version.new(_1) }
end
def head_version
versions["head"]&.then(&Version.method(:new))
versions["head"]&.then { Version.new(_1) }
end
def version_scheme

View File

@ -97,7 +97,7 @@ RSpec.describe Cask::List, :cask do
let(:casks) { [caffeine, transmission] }
it "lists the installed files for those Casks" do
casks.each(&InstallHelper.method(:install_without_artifacts_with_caskfile))
casks.each { InstallHelper.install_without_artifacts_with_caskfile(_1) }
transmission.artifacts.select { |a| a.is_a?(Cask::Artifact::App) }.each do |artifact|
artifact.install_phase(command: NeverSudoSystemCommand, force: false)

View File

@ -124,7 +124,7 @@ RSpec.describe Cask::Uninstall, :cask do
before do
app.tap(&:mkpath)
.join("Contents").tap(&:mkpath)
.join("Info.plist").tap(&FileUtils.method(:touch))
.join("Info.plist").tap { FileUtils.touch(_1) }
caskroom_path.mkpath