Class: Arachni::Reactor::Tasks::Periodic
- Inherits:
-
Persistent
- Object
- Base
- Persistent
- Arachni::Reactor::Tasks::Periodic
- Defined in:
- lib/arachni/reactor/tasks/periodic.rb
Overview
Direct Known Subclasses
Instance Attribute Summary collapse
- #interval ⇒ Float readonly
Attributes inherited from Base
Instance Method Summary collapse
-
#call(*args) ⇒ Object?
Return value of the configured task or
nil
if it's not time yet. -
#initialize(interval, &task) ⇒ Periodic
constructor
A new instance of Periodic.
Methods inherited from Base
Constructor Details
#initialize(interval, &task) ⇒ Periodic
Returns a new instance of Periodic.
26 27 28 29 30 31 32 33 34 |
# File 'lib/arachni/reactor/tasks/periodic.rb', line 26 def initialize( interval, &task ) interval = interval.to_f fail ArgumentError, 'Interval needs to be greater than 0.' if interval <= 0 super( &task ) @interval = interval calculate_next end |
Instance Attribute Details
#interval ⇒ Float (readonly)
21 22 23 |
# File 'lib/arachni/reactor/tasks/periodic.rb', line 21 def interval @interval end |
Instance Method Details
#call(*args) ⇒ Object?
Return value of the configured task or nil
if it's not
time yet.
39 40 41 42 43 44 |
# File 'lib/arachni/reactor/tasks/periodic.rb', line 39 def call( *args ) return if !call? calculate_next super( *args ) end |