Class: Celluloid::StackDump::ActorState

Inherits:
Object
  • Object
show all
Includes:
DisplayBacktrace
Defined in:
lib/celluloid/stack_dump.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DisplayBacktrace

#display_backtrace

Instance Attribute Details

#backtraceObject

Returns the value of attribute backtrace


21
22
23
# File 'lib/celluloid/stack_dump.rb', line 21

def backtrace
  @backtrace
end

#cellObject

Returns the value of attribute cell


19
20
21
# File 'lib/celluloid/stack_dump.rb', line 19

def cell
  @cell
end

#idObject

Returns the value of attribute id


19
20
21
# File 'lib/celluloid/stack_dump.rb', line 19

def id
  @id
end

#nameObject

Returns the value of attribute name


19
20
21
# File 'lib/celluloid/stack_dump.rb', line 19

def name
  @name
end

#statusObject

Returns the value of attribute status


20
21
22
# File 'lib/celluloid/stack_dump.rb', line 20

def status
  @status
end

#tasksObject

Returns the value of attribute tasks


20
21
22
# File 'lib/celluloid/stack_dump.rb', line 20

def tasks
  @tasks
end

Instance Method Details

#dumpObject


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/celluloid/stack_dump.rb', line 23

def dump
  string = ""
  string << "Celluloid::Actor 0x#{id.to_s(16)}"
  string << " [#{name}]" if name
  string << "\n"

  if cell
    string << cell.dump
    string << "\n"
  end

  if status == :idle
    string << "State: Idle (waiting for messages)\n"
    display_backtrace backtrace, string
  else
    string << "State: Running (executing tasks)\n"
    display_backtrace backtrace, string
    string << "\tTasks:\n"

    tasks.each_with_index do |task, i|
      string << "\t  #{i+1}) #{task.task_class}[#{task.type}]: #{task.status}\n"
      string << "\t      #{task.meta.inspect}\n"
      display_backtrace task.backtrace, string, "\t"
    end
  end

  string
end