Class: FireAndForget::Command::SetStatus

Inherits:
CommandBase show all
Defined in:
lib/fire_and_forget/command/set_status.rb

Instance Attribute Summary

Attributes inherited from CommandBase

#cmd, #params, #tag, #task

Instance Method Summary collapse

Methods inherited from CommandBase

#dump, #merge_params

Constructor Details

#initialize(task_name, status_value) ⇒ SetStatus

Returns a new instance of SetStatus.



5
6
7
8
# File 'lib/fire_and_forget/command/set_status.rb', line 5

def initialize(task_name, status_value)
  @task_name, @status_value = task_name.to_sym, status_value
  @pid = $$
end

Instance Method Details

#debugObject



15
16
17
# File 'lib/fire_and_forget/command/set_status.rb', line 15

def debug
  "SetStatus :#{@task_name}: #{@status_value}\n"
end

#runObject



10
11
12
13
# File 'lib/fire_and_forget/command/set_status.rb', line 10

def run
  FireAndForget::Server.set_pid(@task_name, @pid)
  FireAndForget::Server.status[@task_name] = @status_value.to_s
end