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


48
49
50
# File 'lib/celluloid/system_events.rb', line 48

def actor
  @actor
end

#typeObject (readonly)

Returns the value of attribute type


48
49
50
# File 'lib/celluloid/system_events.rb', line 48

def type
  @type
end

Instance Method Details

#process(links) ⇒ Object


54
55
56
57
58
59
60
61
# File 'lib/celluloid/system_events.rb', line 54

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