Class: Scheduler::MessageTask

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

Overview

Describe a Task that send a message to a specific object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, priority, object, message) ⇒ MessageTask

Initialize a MessageTask with its name, priority, the object and the message to send

Parameters:

  • name (String)

    name that describe the task

  • priority (Integer)

    the priority of the task

  • object (Object)

    the object that receive the message

  • message (Array<Symbol, *args>)

    the message to send



135
136
137
138
139
140
# File 'scripts/00700 Ajout_PSDK/00100 Scheduler.rb', line 135

def initialize(name, priority, object, message)
  @name = name
  @priority = -priority
  @object = object
  @message = message
end

Instance Attribute Details

#nameString (readonly)

Name that describe the task

Returns:



129
130
131
# File 'scripts/00700 Ajout_PSDK/00100 Scheduler.rb', line 129

def name
  @name
end

#priorityInteger (readonly)

Priority of the task

Returns:



126
127
128
# File 'scripts/00700 Ajout_PSDK/00100 Scheduler.rb', line 126

def priority
  @priority
end

Instance Method Details

#start

Send the message to the object



143
144
145
# File 'scripts/00700 Ajout_PSDK/00100 Scheduler.rb', line 143

def start
  @object.send(*@message)
end