Class: ActiveMessaging::Adapters::Test::Destination

Inherits:
Object
  • Object
show all
Defined in:
lib/activemessaging/adapters/test.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Destination

Returns a new instance of Destination.



97
98
99
100
# File 'lib/activemessaging/adapters/test.rb', line 97

def initialize name
  @name = name
  @messages = []
end

Instance Attribute Details

#messagesObject

Returns the value of attribute messages.



95
96
97
# File 'lib/activemessaging/adapters/test.rb', line 95

def messages
  @messages
end

#nameObject

Returns the value of attribute name.



95
96
97
# File 'lib/activemessaging/adapters/test.rb', line 95

def name
  @name
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/activemessaging/adapters/test.rb', line 110

def empty?
  @messages.empty?
end

#receiveObject



102
103
104
# File 'lib/activemessaging/adapters/test.rb', line 102

def receive
  @messages.shift
end

#send(message) ⇒ Object



106
107
108
# File 'lib/activemessaging/adapters/test.rb', line 106

def send message
  @messages << message
end

#to_sObject



114
115
116
# File 'lib/activemessaging/adapters/test.rb', line 114

def to_s
  "<Test::Destination name='#{name}' messages='#{@messages.inspect}'>"
end