Class: SayWhen::Triggers::OnceStrategy

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

Instance Attribute Summary collapse

Attributes included from Base

#job

Instance Method Summary collapse

Constructor Details

#initialize(options = nil) ⇒ OnceStrategy

Returns a new instance of OnceStrategy.



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

def initialize(options = nil)
  super
  self.once_at = options[:at] || Time.now
end

Instance Attribute Details

#once_atObject

Returns the value of attribute once_at.



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

def once_at
  @once_at
end

Instance Method Details

#next_fire_at(time = nil) ⇒ Object



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

def next_fire_at(time = nil)
  nfa = once_at if (!time || (time <= once_at))
  nfa
end