ruby-1.9.2 – 未定义的方法`copy’for File:Class

前端之家收集整理的这篇文章主要介绍了ruby-1.9.2 – 未定义的方法`copy’for File:Class前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚刚将一个项目升级Ruby 1.9.2,并且以下行使用’undefined method`copy’为File:Class’
File.copy(animage.image.path(:export),destfile)

我在此模块中加载了以下库

require 'zip/zipfilesystem'
require 'iconv'
require 'net/ftp'
require 'fileutils'

解决方法

它实际上应该是FileUtils.copy或FileUtils.cp.我不知道你的旧项目如何使用File.copy,因为File没有这种方法.

请参考:http://santoro.tk/mirror/ruby-core/classes/FileUtils.html#M004325

原文链接:https://www.f2er.com/ruby/266613.html

猜你在找的Ruby相关文章