gpt4 book ai didi

Ruby 没有选择正确的重载方法

转载 作者:太空宇宙 更新时间:2023-11-03 18:31:01 25 4
gpt4 key购买 nike

我有一个简单的 Nunit runner 用于我的 rake 脚本:

module NUnitRunner

@NUnitPath = "#{RootDir}/tools/nunit/nunit-console.exe";

def self.RunTests(testFile)
system("\"#{@NUnitPath}\" ? \"#{testFile}\"")
end

def self.RunTests(testFile, runArgs)
system("\"#{@NUnitPath}\" ? \"#{testFile}\" #{runArgs}")
end

end

当我在我的任务中调用这个模块时:

# Run Unit Tests
task :run_unit_tests do
puts "Running Unit Tests"

unitTestFile = "#{RootDir}/src/tests/unittests.dll"
NUnitRunner.RunTests(unitTestFile)
end

它只是一直告诉我“错误的参数数量(1 对 2)”,如果我删除带 2 个参数的重载方法它工作正常,那么在这种情况下我不知道 ruby​​ 有一些怪癖?

最佳答案

Ruby 不支持方法重载。

关于Ruby 没有选择正确的重载方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4049817/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com