Class: Celluloid::LinkingRequest

Inherits:
SystemEvent::LinkingEvent show all
Defined in:
lib/celluloid/system_events.rb

Overview

Request to link with another actor

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SystemEvent::LinkingEvent

#initialize

Methods inherited from SystemEvent

handle, handler

Constructor Details

This class inherits a constructor from Celluloid::SystemEvent::LinkingEvent

Instance Attribute Details

#actorObject (readonly)

Returns the value of attribute actor.



51
52
53
# File 'lib/celluloid/system_events.rb', line 51

def actor
  @actor
end

#typeObject (readonly)

Returns the value of attribute type.



51
52
53
# File 'lib/celluloid/system_events.rb', line 51

def type
  @type
end

Instance Method Details

#process(links) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/celluloid/system_events.rb', line 57

def process(links)
  case type
  when :link   then links << actor
  when :unlink then links.delete actor
  end

  actor.mailbox << LinkingResponse.new(Actor.current, type)
end