I'm trying to write an iterator in ruby that sends a callback on the first of every month.
How would you write something like that?
I'm trying to write an iterator in ruby that sends a callback on the first of every month.
How would you write something like that?
if my_date.beginning_of_day == Time.now.beginning_of_month
my callback
end
if Date.today.day == 1
#do something
end
I'm not sure what you mean by an iterator - i hope you don't mean some program that keeps looping, constantly asking if today is the first day of the month? Sounds like a waste of resources. Use crontab :)