class Celluloid::LinkingRequest - celluloid-0.15.2 Documentation

# class Celluloid::LinkingRequest

Request to link with another actor

### Attributes

actor[R]
type[R]

### Public Class Methods

new(actor, type) click to toggle source

    # File lib/celluloid/system_events.rb, line 9
    def initialize(actor, type)
      @actor, @type = actor, type.to_sym
      raise ArgumentError, "type must be link or unlink" unless [:link, :unlink].include?(@type)
    end

### Public Instance Methods

process(links) click to toggle source

    # File lib/celluloid/system_events.rb, line 14
    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