Class: Cheezmiz::Message
- Inherits:
-
Object
show all
- Defined in:
- lib/protocol/message.rb
Direct Known Subclasses
AccountInformation, BuddyInformation, BuddyListBegin, BuddyListEnd, BuddyListRequest, ClientReady, ConnectionEstablished, KeepAliveRequest, KeepAliveResponse, LoginRequest, LoginResponse, SubmitRequest, SubmitResponse, SystemMessage, UnknownOperation
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(params = nil) ⇒ Message
Returns a new instance of Message.
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/protocol/message.rb', line 25
def initialize(params = nil)
if params.respond_to?(:each_pair)
@params = params
else
@params, @sequence_number = decode(params)
@prototype = params
end
check_params @params if self.respond_to? :check_params
@options = populate_from(@params)
end
|
Instance Method Details
#data_fields ⇒ Object
56
57
58
|
# File 'lib/protocol/message.rb', line 56
def data_fields
@params
end
|
#operation ⇒ Object
60
61
62
|
# File 'lib/protocol/message.rb', line 60
def operation
self.class.simple_name.underscore.to_sym
end
|
#prototype ⇒ Object
64
65
66
|
# File 'lib/protocol/message.rb', line 64
def prototype
@prototype || "#{}#{data}"
end
|
#sequence_number ⇒ Object
52
53
54
|
# File 'lib/protocol/message.rb', line 52
def sequence_number
@sequence_number
end
|