Module: Tribe::Actable
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #dead? ⇒ Boolean
- #deliver_event!(event) ⇒ Object
- #direct_message!(command, data = nil, src = nil) ⇒ Object
- #exception ⇒ Object
- #identifier ⇒ Object
- #logger ⇒ Object
- #name ⇒ Object
- #perform!(&block) ⇒ Object
- #pool ⇒ Object
- #registry ⇒ Object
- #shutdown! ⇒ Object
- #spawn!(klass, actor_options = {}, spawn_options = {}) ⇒ Object
Instance Method Details
#alive? ⇒ Boolean
92 93 94 |
# File 'lib/tribe/actable.rb', line 92 def alive? @_actable.mailbox.alive? end |
#dead? ⇒ Boolean
96 97 98 |
# File 'lib/tribe/actable.rb', line 96 def dead? !alive? end |
#deliver_event!(event) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/tribe/actable.rb', line 46 def deliver_event!(event) @_actable.mailbox.push(event) do process_events end nil end |
#direct_message!(command, data = nil, src = nil) ⇒ Object
54 55 56 57 58 |
# File 'lib/tribe/actable.rb', line 54 def (command, data = nil, src = nil) deliver_event!(Tribe::Event.new(command, data, src)) nil end |
#exception ⇒ Object
108 109 110 |
# File 'lib/tribe/actable.rb', line 108 def exception @_actable.exception end |
#identifier ⇒ Object
104 105 106 |
# File 'lib/tribe/actable.rb', line 104 def identifier @_actable.name ? "#{object_id}:#{@_actable.name}" : object_id end |
#logger ⇒ Object
120 121 122 |
# File 'lib/tribe/actable.rb', line 120 def logger @_actable.logger end |
#name ⇒ Object
100 101 102 |
# File 'lib/tribe/actable.rb', line 100 def name @_actable.name end |
#perform!(&block) ⇒ Object
64 65 66 |
# File 'lib/tribe/actable.rb', line 64 def perform!(&block) (:__perform__, block) end |
#pool ⇒ Object
116 117 118 |
# File 'lib/tribe/actable.rb', line 116 def pool @_actable.pool end |
#registry ⇒ Object
112 113 114 |
# File 'lib/tribe/actable.rb', line 112 def registry @_actable.registry end |
#shutdown! ⇒ Object
60 61 62 |
# File 'lib/tribe/actable.rb', line 60 def shutdown! (:__shutdown__) end |
#spawn!(klass, actor_options = {}, spawn_options = {}) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/tribe/actable.rb', line 68 def spawn!(klass, = {}, = {}) [:parent] = self child = nil if [:no_raise_on_failure] begin child = klass.new() rescue Exception return false end else child = klass.new() end @_actable.children.add(child) if [:supervise] @_actable.supervisees.add(child) end child end |