I'm trying to set a Whenever job that should be executed 2 times a day, exactly at 11am and 11pm. Is there any way to do it with only one block? I mean something like this:
every :day, :at => ['11am','11pm'] do
runner "Task"
end
I'm trying to set a Whenever job that should be executed 2 times a day, exactly at 11am and 11pm. Is there any way to do it with only one block? I mean something like this:
every :day, :at => ['11am','11pm'] do
runner "Task"
end
If you're concerned about DRYness of your code, then how about this?
['11am','11pm'].each do |at|
every :day, :at => at do
runner "Task"
end
end
Just pass an array to the :at
option.
every :day, at: ["11am", "11pm"] do
runner "Task"
end
If you're concerned about DRYness of your code, then how about this?
['11am','11pm'].each do |at|
every :day, :at => at do
runner "Task"
end
end
© 2022 - 2024 — McMap. All rights reserved.