Class: SayWhen::Triggers::OnceStrategy
- Inherits:
-
Object
- Object
- SayWhen::Triggers::OnceStrategy
- Includes:
- Base
- Defined in:
- lib/say_when/triggers/once_strategy.rb
Instance Attribute Summary collapse
-
#once_at ⇒ Object
Returns the value of attribute once_at.
Attributes included from Base
Instance Method Summary collapse
-
#initialize(options = nil) ⇒ OnceStrategy
constructor
A new instance of OnceStrategy.
- #next_fire_at(time = nil) ⇒ Object
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( = nil) super self.once_at = [:at] || Time.now end |
Instance Attribute Details
#once_at ⇒ Object
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 |