Class: SayWhen::Triggers::InstanceStrategy

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/say_when/triggers/instance_strategy.rb

Instance Attribute Summary collapse

Attributes included from Base

#job

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ InstanceStrategy

Returns a new instance of InstanceStrategy.



12
13
14
15
16
# File 'lib/say_when/triggers/instance_strategy.rb', line 12

def initialize(options = {})
  super
  self.instance = job.scheduled
  self.next_at_method = options[:next_at_method] || 'next_fire_at'
end

Instance Attribute Details

#instanceObject

Returns the value of attribute instance.



10
11
12
# File 'lib/say_when/triggers/instance_strategy.rb', line 10

def instance
  @instance
end

#next_at_methodObject

Returns the value of attribute next_at_method.



10
11
12
# File 'lib/say_when/triggers/instance_strategy.rb', line 10

def next_at_method
  @next_at_method
end

Instance Method Details

#next_fire_at(time = Time.now) ⇒ Object



18
19
20
# File 'lib/say_when/triggers/instance_strategy.rb', line 18

def next_fire_at(time = Time.now)
  instance.send(next_at_method, time)
end