Class: AMQ::Protocol::Class
- Inherits:
-
Object
- Object
- AMQ::Protocol::Class
show all
- Defined in:
- lib/amq/protocol/client.rb
Overview
We don’t instantiate the following classes, as we don’t actually need any per-instance state. Also, this is pretty low-level functionality, hence it should have a reasonable performance. As everyone knows, garbage collector in MRI performs really badly, which is another good reason for not creating any objects, but only use class as a struct. Creating classes is quite expensive though, but here the inheritance comes handy and mainly as we can’t simply make a reference to a function, we can’t use a hash or an object. I’ve been also considering to have just a bunch of methods, but here’s the problem, that after we’d require this file, all these methods would become global which would be a bad, bad thing to do.
Class Method Summary
collapse
Class Method Details
.classes ⇒ Object
211
212
213
|
# File 'lib/amq/protocol/client.rb', line 211
def self.classes
@classes
end
|
.inherited(base) ⇒ Object
205
206
207
208
209
|
# File 'lib/amq/protocol/client.rb', line 205
def self.inherited(base)
if self == Protocol::Class
@classes << base
end
end
|
.method_id ⇒ Object
197
198
199
|
# File 'lib/amq/protocol/client.rb', line 197
def self.method_id
@method_id
end
|
.name ⇒ Object
201
202
203
|
# File 'lib/amq/protocol/client.rb', line 201
def self.name
@name
end
|