Module: AMQP::Protocol
- Defined in:
- lib/amqp/spec.rb,
lib/amqp/spec.rb,
lib/amqp/protocol.rb
Defined Under Namespace
Classes: Access, Basic, Channel, Class, Connection, Dtx, Exchange, File, Header, Queue, Stream, Test, Tunnel, Tx
Class Method Summary
collapse
Class Method Details
.Class(id, name) ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/amqp/spec.rb', line 130
def self.Class(id, name)
@_base_classes ||= {}
@_base_classes[id] ||= ::Class.new(Class) do
class_eval %[
def self.inherited klass
klass.const_set(:ID, #{id})
klass.const_set(:NAME, :#{name.to_s})
Protocol.classes[#{id}] = klass
Protocol.classes[klass::NAME] = klass
end
]
end
end
|
.classes ⇒ Object
128
|
# File 'lib/amqp/spec.rb', line 128
def self.classes() @classes ||= {} end
|
.parse(buf) ⇒ Object
154
155
156
157
158
|
# File 'lib/amqp/protocol.rb', line 154
def self.parse buf
buf = Buffer.new(buf) unless buf.is_a? Buffer
class_id, method_id = buf.read(:short, :short)
classes[class_id].methods[method_id].new(buf)
end
|