Class: Scheduler::ProcTask

Inherits:
Object show all
Defined in:
scripts/00700 Ajout_PSDK/00100 Scheduler.rb

Overview

Description of a Task that execute a Proc

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, priority, proc_object) ⇒ ProcTask

Initialize a ProcTask with its name, priority and the Proc it executes

Parameters:

  • name (String)

    name that describe the task

  • priority (Integer)

    the priority of the task

  • proc_object (Proc)

    the proc (with no param) of the task



98
99
100
101
102
# File 'scripts/00700 Ajout_PSDK/00100 Scheduler.rb', line 98

def initialize(name, priority, proc_object)
  @name = name
  @priority = -priority
  @proc = proc_object
end

Instance Attribute Details

#nameString (readonly)

Name that describe the task

Returns:



93
94
95
# File 'scripts/00700 Ajout_PSDK/00100 Scheduler.rb', line 93

def name
  @name
end

#priorityInteger (readonly)

Priority of the task

Returns:



90
91
92
# File 'scripts/00700 Ajout_PSDK/00100 Scheduler.rb', line 90

def priority
  @priority
end

Instance Method Details

#start

Invoke the #call method of the proc



105
106
107
# File 'scripts/00700 Ajout_PSDK/00100 Scheduler.rb', line 105

def start
  @proc.call
end