17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/orient_db_client/network_message.rb', line 17
def pack()
packing_list = @components.map do |c|
case c[:type]
when :byte then 'C'
when :integer then 'l>'
when :long then 'q>'
when :short then 's>'
when :string, :raw_string then 'a*'
end
end
content = @components.map do |c|
value = c[:value]
if c[:type] == :byte && value.is_a?(String)
c[:value] = value.length > 0 ? value[0].ord : 0
end
c[:value]
end
content.pack packing_list.join(" ")
end
|