-
Notifications
You must be signed in to change notification settings - Fork 47
MyJob.enqueue Syntax #77
Comments
That's going to conflict with people who expect a hash of options to their own job, unfortunately. When the argument is first, it's unambiguous.
|
What would work is MyJob.enque in: 5.hours, args:[1, 2, option: 3]
MyJob.enque at: 5.hours.from_now, args:[1, 2, option: 3]
MyJob.enque args:[1, 2, option: 3] but I personally prefer the 3 methods |
👍 for staying with the current syntax only. |
What about this? MyJob.at(Date.tomorrow).enqueue record
MyJob.in(1.week).enqueue record Or this (bad for default usage)? MyJob.enqueue(record).now
MyJob.enqueue(record).at Date.tomorrow
MyJob.enqueue(record).in 1.week |
I don’t think that’s an improvement on the there separate enqueue methods. On May 30, 2014, at 5:31 PM, Alexander Senko notifications@github.com wrote:
|
Given the job arguments issue I believe the current syntax is the most appropriate. |
Hi there,
I believe, to get a more consistent Rails-like syntax, that enqueue should have an options hash opposed to enqueue_in and enqueue_at methods.
So these would be valid method calls:
Since the given method definition is valid Ruby:
it seems to me that it's a most concise approach given Rails method definitions.
What do you think?
The text was updated successfully, but these errors were encountered: