0
пыльник мой file_open.rbнеопределенный метод `open_and_process' для файла: Класс
def File
def self.open_and_process(*args)
f = File.open(*args)
yield f
f.close
end
end
File.open_and_process("testfile", "r") do |file|
while line = file.gets
puts line
end
end
ошибка я всегда получили: неопределенный метод` open_and_process' для файла: Class (NoMethodError)
определения функции File' не так, как вы открываете файл класс, это класс 'File' , –