Class: DCell::Message::Relay

Inherits:
DCell::Message show all
Defined in:
lib/dcell/messages.rb

Overview

Relay a message to the given recipient

Instance Attribute Summary collapse

Attributes inherited from DCell::Message

#id

Instance Method Summary collapse

Constructor Details

#initialize(recipient, message) ⇒ Relay

Returns a new instance of Relay.



55
56
57
58
# File 'lib/dcell/messages.rb', line 55

def initialize(recipient, message)
  super()
  @recipient, @message = recipient, message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



53
54
55
# File 'lib/dcell/messages.rb', line 53

def message
  @message
end

#recipientObject (readonly)

Returns the value of attribute recipient.



53
54
55
# File 'lib/dcell/messages.rb', line 53

def recipient
  @recipient
end

Instance Method Details

#dispatchObject



60
61
62
# File 'lib/dcell/messages.rb', line 60

def dispatch
  @recipient << @message
end