Class: Secondhand::Trigger

Inherits:
Object
  • Object
show all
Defined in:
lib/secondhand/trigger.rb

Class Method Summary collapse

Class Method Details

.create(name, opts) ⇒ Object

Return correct Quartz Trigger



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/secondhand/trigger.rb', line 8

def self.create(name, opts)
  args = ["#{name}_trigger", Secondhand::DEFAULT_GROUP]
  
  # with_cron trumps other options
  if opts[:with_cron]
    args << opts[:with_cron]
    CronTrigger.new(*(args).compact)
  else
    args << opts[:at] || opts[:on]        
    SimpleTrigger.new(*(args).compact)
  end
end