惊喜程序问题集(17) - 泄漏的奥秘I
2017-09-04 本文已影响0人
cs_cl
1.运行下面这段代码,并解释它的输出
2.将.map方法�改为.each后再次运行,并解释它的输出
# tmpfile.rb
require 'tempfile'
def maxfds
(0..50000).map do |i|
begin
Tempfile.new('rippletek')
rescue
return i
end
end
end
puts maxfds