- curret_path = File.dirname(__FILE__)
- file_path = curret_path + '/data/quotes.txt'
- puts 'Афоризм дня:'
- if File.exist?(file_path)
- f = File.open(file_path,'r:UTF-8'){ |file| file.readlines }
- puts f.sample
- f.close # Закрытие файла
- else
- puts 'Файл не найден'
- end