Problems with the study of Ruby, the task to read from the csv file of the date (dd.mm.yyy), and after, output the dates (all dates of the 21st century) that come before and, separately, which come after the entered date. So far, I was able to implement only the reading (and that is crooked in my opinion) and output. Stuck on trying to sort them. (In the 3 dates file 05/12/2021 1/21/2016 12/23/2019) file http://rghost.ru/88rySyvnc
require 'CSV' require 'date' require 'twitter_cldr' class Date sort_date = gets sort_date1 = sort_date.split('<br>').map(&:strip).map { |d| DateTime.parse(d) } file = File.new("date.csv") file.each do |line| line.split('.').last.to_i date = line.split('<br>').map(&:strip).map { |d| DateTime.parse(d) } date1 = date puts "#{date1}" end end
class Date<- uh, why? - D-side