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