我想本身递归Ruby中 - 回归方法本身
def self.open_folder(file)
Dir.glob(file+"*") do |subfiles|
if File.directory?(subfiles)
open_folder(subfiles) ###Problem here
end
if File.file?(subfiles)
open_file(subfiles)
end
end
end
我想是返回“open_folder”保持开放的子文件夹返回的方法。我得到了一个错误
block in open_folder': stack level too deep
你能帮我找到解决方案吗?
解决您的压痕。 –
嗯“堆栈层面太深”大多意味着你有无限递归 – niceman