Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试设置一个应每天执行 2 次的 When 作业,恰好在上午 11 点和晚上 11 点。有什么办法只用一个块吗?我的意思是这样的:
every :day, :at => ['11am','11pm'] do runner "Task" end
只需将数组传递给:at选项。
:at
every :day, at: ["11am", "11pm"] do runner "Task" end
如果您担心代码的 DRYness,那么这个怎么样?
['11am','11pm'].each do |at| every :day, :at => at do runner "Task" end end