From db982373c770146482b104e8c35e4b241e297de2 Mon Sep 17 00:00:00 2001 From: Trevor Vallender Date: Sun, 3 Mar 2024 14:52:12 +0000 Subject: [PATCH] Output an ical file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Almost there—but we’re only adding birthdays to the current year. --- lib/birthdaze.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/birthdaze.rb b/lib/birthdaze.rb index 96d46f7..9f56815 100644 --- a/lib/birthdaze.rb +++ b/lib/birthdaze.rb @@ -6,8 +6,8 @@ require "yaml" class Birthdaze < Thor desc "generate", "Generate calendars" def generate - puts "Generate calendars" - puts calendar.inspect + puts "Writing ical file to #{config['ical_output']}" + File.open(config["ical_output"], 'w') { |file| file.write(calendar.to_ical) } end desc "list", "List birthdays" @@ -90,11 +90,7 @@ class Birthdaze < Thor end def summary(name, birthday) - return "#{name}’s birthday" if birthday.start_with?("-") || birthday.start_with?("1604") - - birth_year = birthday[0..3].to_i - age = Date.today.year - birth_year + 1 - "🎂 #{name}’s #{age} birthday" + return "🎂 #{name}’s birthday" end def set_reminders