Class: Arachni::Reactor::Tasks
- Inherits:
-
Object
- Object
- Arachni::Reactor::Tasks
- Includes:
- Mutex_m
- Defined in:
- lib/arachni/reactor/tasks.rb,
lib/arachni/reactor/tasks/base.rb,
lib/arachni/reactor/tasks/delayed.rb,
lib/arachni/reactor/tasks/one_off.rb,
lib/arachni/reactor/tasks/periodic.rb,
lib/arachni/reactor/tasks/persistent.rb
Overview
Task list.
Defined Under Namespace
Classes: Base, Delayed, OneOff, Periodic, Persistent
Instance Method Summary collapse
-
#<<(task) ⇒ Tasks
self
. - #any? ⇒ Bool
-
#call(*args) ⇒ Tasks
Calls all tasks.
-
#clear ⇒ Tasks
Removes all tasks.
-
#delete(task) ⇒ Base?
The task if it was included,
nil
otherwise. - #empty? ⇒ Bool
- #hash ⇒ Object
- #include?(task) ⇒ Bool
-
#initialize ⇒ Tasks
constructor
A new instance of Tasks.
- #size ⇒ Integer
Constructor Details
#initialize ⇒ Tasks
Returns a new instance of Tasks.
26 27 28 29 30 |
# File 'lib/arachni/reactor/tasks.rb', line 26 def initialize super @tasks = [] end |
Instance Method Details
#<<(task) ⇒ Tasks
38 39 40 41 42 43 44 45 |
# File 'lib/arachni/reactor/tasks.rb', line 38 def <<( task ) synchronize do task.owner = self @tasks << task end self end |
#any? ⇒ Bool
77 78 79 |
# File 'lib/arachni/reactor/tasks.rb', line 77 def any? !empty? end |
#call(*args) ⇒ Tasks
Calls all tasks.
95 96 97 98 |
# File 'lib/arachni/reactor/tasks.rb', line 95 def call( *args ) @tasks.dup.each { |t| t.call *args } self end |
#clear ⇒ Tasks
Removes all tasks.
84 85 86 87 88 89 90 |
# File 'lib/arachni/reactor/tasks.rb', line 84 def clear synchronize do @tasks.clear end self end |
#delete(task) ⇒ Base?
Returns The task if it was included, nil
otherwise.
58 59 60 61 62 63 64 |
# File 'lib/arachni/reactor/tasks.rb', line 58 def delete( task ) synchronize do task = @tasks.delete( task ) task.owner = nil if task task end end |
#empty? ⇒ Bool
72 73 74 |
# File 'lib/arachni/reactor/tasks.rb', line 72 def empty? @tasks.empty? end |
#hash ⇒ Object
100 101 102 |
# File 'lib/arachni/reactor/tasks.rb', line 100 def hash @tasks.hash end |
#include?(task) ⇒ Bool
50 51 52 |
# File 'lib/arachni/reactor/tasks.rb', line 50 def include?( task ) @tasks.include? task end |
#size ⇒ Integer
67 68 69 |
# File 'lib/arachni/reactor/tasks.rb', line 67 def size @tasks.size end |