Class: Fluffle::Testing::Loopback::Channel
- Inherits:
-
Object
- Object
- Fluffle::Testing::Loopback::Channel
- Defined in:
- lib/fluffle/testing.rb
Instance Method Summary collapse
- #ack(delivery_tag, multiple = false) ⇒ Object
- #close ⇒ Object
- #confirm_select(block = nil) ⇒ Object
- #default_exchange ⇒ Object
-
#initialize(server) ⇒ Channel
constructor
A new instance of Channel.
- #next_publish_seq_no ⇒ Object
- #prefetch(number, global = false) ⇒ Object
- #publish(payload, opts) ⇒ Object
- #queue(name, **opts) ⇒ Object
Constructor Details
#initialize(server) ⇒ Channel
Returns a new instance of Channel.
114 115 116 117 118 119 |
# File 'lib/fluffle/testing.rb', line 114 def initialize(server) @server = server @confirm_select = nil @next_publish_seq_no = 0 end |
Instance Method Details
#ack(delivery_tag, multiple = false) ⇒ Object
155 156 157 |
# File 'lib/fluffle/testing.rb', line 155 def ack(delivery_tag, multiple = false) true end |
#close ⇒ Object
159 160 |
# File 'lib/fluffle/testing.rb', line 159 def close end |
#confirm_select(block = nil) ⇒ Object
125 126 127 128 |
# File 'lib/fluffle/testing.rb', line 125 def confirm_select(block = nil) @confirm_select = block @next_publish_seq_no = 1 end |
#default_exchange ⇒ Object
121 122 123 |
# File 'lib/fluffle/testing.rb', line 121 def default_exchange @default_exchange ||= Exchange.new(@server, self) end |
#next_publish_seq_no ⇒ Object
130 131 132 |
# File 'lib/fluffle/testing.rb', line 130 def next_publish_seq_no @next_publish_seq_no end |
#prefetch(number, global = false) ⇒ Object
134 135 |
# File 'lib/fluffle/testing.rb', line 134 def prefetch(number, global = false) end |
#publish(payload, opts) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/fluffle/testing.rb', line 143 def publish(payload, opts) if @confirm_select multiple = false nack = false @confirm_select.call @next_publish_seq_no, multiple, nack end @server.publish payload, opts @next_publish_seq_no += 1 if @next_publish_seq_no > 0 end |