Class: AMQ::Protocol::Method
- Inherits:
-
Object
- Object
- AMQ::Protocol::Method
show all
- Defined in:
- lib/amq/protocol/client.rb
Direct Known Subclasses
Basic::Ack, Basic::Cancel, Basic::CancelOk, Basic::Consume, Basic::ConsumeOk, Basic::Deliver, Basic::Get, Basic::GetEmpty, Basic::GetOk, Basic::Nack, Basic::Publish, Basic::Qos, Basic::QosOk, Basic::Recover, Basic::RecoverAsync, Basic::RecoverOk, Basic::Reject, Basic::Return, Channel::Close, Channel::CloseOk, Channel::Flow, Channel::FlowOk, Channel::Open, Channel::OpenOk, Confirm::Select, Confirm::SelectOk, Connection::Close, Connection::CloseOk, Connection::Open, Connection::OpenOk, Connection::Secure, Connection::SecureOk, Connection::Start, Connection::StartOk, Connection::Tune, Connection::TuneOk, Exchange::Bind, Exchange::BindOk, Exchange::Declare, Exchange::DeclareOk, Exchange::Delete, Exchange::DeleteOk, Exchange::Unbind, Exchange::UnbindOk, Queue::Bind, Queue::BindOk, Queue::Declare, Queue::DeclareOk, Queue::Delete, Queue::DeleteOk, Queue::Purge, Queue::PurgeOk, Queue::Unbind, Queue::UnbindOk, Tx::Commit, Tx::CommitOk, Tx::Rollback, Tx::RollbackOk, Tx::Select, Tx::SelectOk
Class Method Summary
collapse
Class Method Details
.encode_body(body, channel, frame_size) ⇒ Object
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
# File 'lib/amq/protocol/client.rb', line 254
def self.encode_body(body, channel, frame_size)
return [] if body.empty?
limit = frame_size - 8
body.force_encoding("ASCII-8BIT") if RUBY_VERSION.to_f >= 1.9
array = Array.new
while body
payload, body = body[0, limit], body[limit, body.length - limit]
array << BodyFrame.new(payload, channel)
end
array
end
|
.index ⇒ Object
226
227
228
|
# File 'lib/amq/protocol/client.rb', line 226
def self.index
@index
end
|
.inherited(base) ⇒ Object
230
231
232
233
234
|
# File 'lib/amq/protocol/client.rb', line 230
def self.inherited(base)
if self == Protocol::Method
@methods << base
end
end
|
.instantiate(*args, &block) ⇒ Object
We can return different:
-
instantiate given subclass of Method
-
create an OpenStruct object
-
create a hash
-
yield params into the block rather than just return
283
284
285
286
287
288
|
# File 'lib/amq/protocol/client.rb', line 283
def self.instantiate(*args, &block)
self.new(*args, &block)
end
|
.method_id ⇒ Object
218
219
220
|
# File 'lib/amq/protocol/client.rb', line 218
def self.method_id
@method_id
end
|
.methods ⇒ Object
236
237
238
|
# File 'lib/amq/protocol/client.rb', line 236
def self.methods
@methods
end
|
.name ⇒ Object
222
223
224
|
# File 'lib/amq/protocol/client.rb', line 222
def self.name
@name
end
|
240
241
242
243
244
245
246
247
248
249
250
251
252
|
# File 'lib/amq/protocol/client.rb', line 240
def self.()
properties, = {}, {}
.each do |key, value|
if Basic::PROPERTIES.include?(key)
properties[key] = value
else
[key] = value
end
end
return [properties, ]
end
|