def record
return unless @supported
klasses = profile_options[:formats].map { |f| RubyProf.const_get("#{f.to_s.camelize}Printer") }.compact
klasses.each do |klass|
fname = output_filename(klass)
FileUtils.mkdir_p(File.dirname(fname))
File.open(fname, 'wb') do |file|
klass.new(@data).print(file, profile_options.slice(:min_percent))
end
end
end
我知道'klass'用於防止與關鍵字'class'的命名空間衝突,但爲什麼要在此代碼中使用'klass'或'class'(來自Rails :: ActiveSupport) - 目的是什麼他們服務?什麼是克拉斯在這裏使用?或者,如果使用班級,爲什麼需要?什麼是klass/class?爲什麼在這段代碼中需要klass?