Class: Celluloid::Internals::Stack::ActorState

Inherits:
Object
  • Object
show all
Includes:
DisplayBacktrace
Defined in:
lib/celluloid/internals/stack/states.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


37
38
39
# File 'lib/celluloid/internals/stack/states.rb', line 37

def backtrace
  @backtrace
end

#cellObject

Returns the value of attribute cell


35
36
37
# File 'lib/celluloid/internals/stack/states.rb', line 35

def cell
  @cell
end

#idObject

Returns the value of attribute id


35
36
37
# File 'lib/celluloid/internals/stack/states.rb', line 35

def id
  @id
end

#nameObject

Returns the value of attribute name


35
36
37
# File 'lib/celluloid/internals/stack/states.rb', line 35

def name
  @name
end

#statusObject

Returns the value of attribute status


36
37
38
# File 'lib/celluloid/internals/stack/states.rb', line 36

def status
  @status
end

#tasksObject

Returns the value of attribute tasks


36
37
38
# File 'lib/celluloid/internals/stack/states.rb', line 36

def tasks
  @tasks
end

Instance Method Details

#dumpObject


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/celluloid/internals/stack/states.rb', line 39

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 if backtrace
  else
    string << "State: Running (executing tasks)\n"
    display_backtrace backtrace, string if backtrace
    string << "\tTasks:\n"

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