Untitled
unknown
ruby
3 years ago
1.0 kB
7
Indexable
require 'rufus-scheduler'
scheduler = Rufus::Scheduler.new
# Schedule a random time each day for the user to read their scriptures
scheduler.cron '0 0 * * *' do
reminder_time = Time.now + rand(60*60*24) # add a random number of seconds (up to 24 hours) to the current time
puts "Reminder: Read your scriptures at #{reminder_time.strftime('%I:%M %p')}"
end
# Schedule a random time each day for the user to say a prayer
scheduler.cron '0 0 * * *' do
reminder_time = Time.now + rand(60*60*24) # add a random number of seconds (up to 24 hours) to the current time
puts "Reminder: Say a prayer at #{reminder_time.strftime('%I:%M %p')}"
end
# Schedule a random time each day for the user to tell someone they love them
scheduler.cron '0 0 * * *' do
reminder_time = Time.now + rand(60*60*24) # add a random number of seconds (up to 24 hours) to the current time
puts "Reminder: Tell someone you love them at #{reminder_time.strftime('%I:%M %p')}"
end
# Run the scheduler in the background
scheduler.join
Editor is loading...