Class: Arachni::Reactor::Tasks::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/arachni/reactor/tasks/base.rb

Overview

Callable task.

Author:

Direct Known Subclasses

OneOff, Persistent

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&task) ⇒ Base

Returns a new instance of Base.

Parameters:

  • task (Block)


23
24
25
26
27
# File 'lib/arachni/reactor/tasks/base.rb', line 23

def initialize( &task )
    fail ArgumentError, 'Missing block.' if !block_given?

    @task = task
end

Instance Attribute Details

#ownerTasks

Returns List managing this task.

Returns:

  • (Tasks)

    List managing this task.



20
21
22
# File 'lib/arachni/reactor/tasks/base.rb', line 20

def owner
  @owner
end

Instance Method Details

#call(*args) ⇒ Object

This method is abstract.

Calls the configured task and passes args and self` to it.



32
33
34
# File 'lib/arachni/reactor/tasks/base.rb', line 32

def call( *args )
    fail NotImplementedError
end

#doneObject

Removes the task from the #owner's list.



37
38
39
# File 'lib/arachni/reactor/tasks/base.rb', line 37

def done
    @owner.delete self
end

#hashObject



45
46
47
# File 'lib/arachni/reactor/tasks/base.rb', line 45

def hash
    @task.hash
end

#to_procObject



41
42
43
# File 'lib/arachni/reactor/tasks/base.rb', line 41

def to_proc
    @task
end