Class: Harmoniser::Mock::Channel
- Inherits:
-
Object
- Object
- Harmoniser::Mock::Channel
show all
- Defined in:
- lib/harmoniser/mock/channel.rb
Defined Under Namespace
Classes: MockExchange, MockQueue
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Channel.
46
47
48
49
50
|
# File 'lib/harmoniser/mock/channel.rb', line 46
def initialize
@exchanges = {}
@queues = {}
@bindings = []
end
|
Instance Method Details
#bindings ⇒ Object
77
78
79
|
# File 'lib/harmoniser/mock/channel.rb', line 77
def bindings
@bindings.dup
end
|
#bunny_channel ⇒ Object
87
88
89
|
# File 'lib/harmoniser/mock/channel.rb', line 87
def bunny_channel
raise "Cannot access bunny_channel in mock mode. Mock mode is intended for testing only and cannot be used when running Harmoniser as a server process."
end
|
#exchange(name, opts = {}) ⇒ Object
52
53
54
|
# File 'lib/harmoniser/mock/channel.rb', line 52
def exchange(name, opts = {})
@exchanges[name] ||= MockExchange.new(name, opts)
end
|
#exchanges ⇒ Object
69
70
71
|
# File 'lib/harmoniser/mock/channel.rb', line 69
def exchanges
@exchanges.dup
end
|
#queue(name, opts = {}) ⇒ Object
56
57
58
|
# File 'lib/harmoniser/mock/channel.rb', line 56
def queue(name, opts = {})
@queues[name] ||= MockQueue.new(name, opts)
end
|
#queue_bind(destination_name, exchange_name, opts = {}) ⇒ Object
60
61
62
63
64
65
66
67
|
# File 'lib/harmoniser/mock/channel.rb', line 60
def queue_bind(destination_name, exchange_name, opts = {})
@bindings << {
destination_name: destination_name,
exchange_name: exchange_name,
opts: opts
}
true
end
|
#queues ⇒ Object
73
74
75
|
# File 'lib/harmoniser/mock/channel.rb', line 73
def queues
@queues.dup
end
|
#reset! ⇒ Object
81
82
83
84
85
|
# File 'lib/harmoniser/mock/channel.rb', line 81
def reset!
@exchanges.clear
@queues.clear
@bindings.clear
end
|