Class: Dcmgr::VNet::TaskManager

Inherits:
Object
  • Object
show all
Defined in:
lib/dcmgr/vnet.rb

Overview

Abstract class for task managers to extend A task manager should be able to understand certain rules in a task and be able to apply those

Direct Known Subclasses

Netfilter::NetfilterTaskManager

Instance Method Summary collapse

Instance Method Details

#apply_task(task) ⇒ Object

Raises:

  • (NotImplementedError)


71
72
73
# File 'lib/dcmgr/vnet.rb', line 71

def apply_task(task)
  raise NotImplementedError
end

#apply_tasks(tasks) ⇒ Object

Raises:

  • (ArgumentError)


75
76
77
78
79
80
81
# File 'lib/dcmgr/vnet.rb', line 75

def apply_tasks(tasks)
  raise ArgumentError, "tasks must be an Array of Tasks." unless tasks.is_a?(Array)
  tasks.each { |task|
    next unless task.is_a?(Task)
    apply_task(task)
  }
end

#remove_task(task) ⇒ Object

Raises:

  • (NotImplementedError)


83
84
85
# File 'lib/dcmgr/vnet.rb', line 83

def remove_task(task)
  raise NotImplementedError
end

#remove_tasks(tasks) ⇒ Object

TODO: Change Array to Enumerable

Raises:

  • (ArgumentError)


88
89
90
91
92
93
94
# File 'lib/dcmgr/vnet.rb', line 88

def remove_tasks(tasks)
  raise ArgumentError, "tasks must be an Array of Tasks." unless tasks.is_a?(Array)
  tasks.each { |task|
    next unless task.is_a?(Task)
    remove_task(task)
  }
end