maxcube-client 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/data/save/20180214-2023/recv.data +12 -0
  4. data/data/save/20180214-2023/recv.yaml +152 -0
  5. data/data/save/20180214-2023/sent.data +10 -0
  6. data/data/save/20180214-2023/sent.yaml +26 -0
  7. data/data/save/20180214-2230/recv.data +2 -0
  8. data/data/save/20180214-2230/recv.yaml +68 -0
  9. data/data/save/20180214-2230/sent.data +1 -0
  10. data/data/save/20180214-2230/sent.yaml +19 -0
  11. data/data/save/20180215-0057/recv.data +3 -0
  12. data/data/save/20180215-0057/recv.yaml +69 -0
  13. data/data/save/20180215-0057/sent.data +2 -0
  14. data/data/save/20180215-0057/sent.yaml +22 -0
  15. data/data/save/20180216-1641/recv.data +4 -0
  16. data/data/save/20180216-1641/recv.yaml +133 -0
  17. data/data/save/20180216-1641/sent.data +2 -0
  18. data/data/save/20180216-1641/sent.yaml +3 -0
  19. data/lib/maxcube/version.rb +1 -1
  20. data/maxcube-client.gemspec +5 -6
  21. data/spec/msg_spec.rb +2117 -0
  22. data/spec/spec_helper.rb +7 -0
  23. metadata +21 -75
  24. data/.gitignore +0 -6
  25. data/.rubocop.yml +0 -29
  26. data/.yardopts +0 -1
  27. data/Gemfile +0 -5
  28. data/bin/console +0 -8
  29. data/bin/maxcube-client +0 -6
  30. data/bin/sample_server +0 -13
  31. data/bin/sample_socket +0 -13
  32. data/bin/setup +0 -6
  33. data/doc/MaxCube.html +0 -502
  34. data/doc/MaxCube/Messages.html +0 -1927
  35. data/doc/MaxCube/Messages/Handler.html +0 -2912
  36. data/doc/MaxCube/Messages/InvalidMessage.html +0 -140
  37. data/doc/MaxCube/Messages/InvalidMessageBody.html +0 -264
  38. data/doc/MaxCube/Messages/InvalidMessageFormat.html +0 -247
  39. data/doc/MaxCube/Messages/InvalidMessageLength.html +0 -247
  40. data/doc/MaxCube/Messages/InvalidMessageType.html +0 -263
  41. data/doc/MaxCube/Messages/Parser.html +0 -520
  42. data/doc/MaxCube/Messages/Serializer.html +0 -701
  43. data/doc/MaxCube/Messages/TCP.html +0 -172
  44. data/doc/MaxCube/Messages/TCP/Handler.html +0 -1396
  45. data/doc/MaxCube/Messages/TCP/Parser.html +0 -462
  46. data/doc/MaxCube/Messages/TCP/Parser/MessageA.html +0 -186
  47. data/doc/MaxCube/Messages/TCP/Parser/MessageC.html +0 -1077
  48. data/doc/MaxCube/Messages/TCP/Parser/MessageF.html +0 -206
  49. data/doc/MaxCube/Messages/TCP/Parser/MessageH.html +0 -338
  50. data/doc/MaxCube/Messages/TCP/Parser/MessageL.html +0 -535
  51. data/doc/MaxCube/Messages/TCP/Parser/MessageM.html +0 -510
  52. data/doc/MaxCube/Messages/TCP/Parser/MessageN.html +0 -226
  53. data/doc/MaxCube/Messages/TCP/Parser/MessageS.html +0 -225
  54. data/doc/MaxCube/Messages/TCP/Serializer.html +0 -460
  55. data/doc/MaxCube/Messages/TCP/Serializer/MessageA.html +0 -186
  56. data/doc/MaxCube/Messages/TCP/Serializer/MessageC.html +0 -185
  57. data/doc/MaxCube/Messages/TCP/Serializer/MessageF.html +0 -206
  58. data/doc/MaxCube/Messages/TCP/Serializer/MessageL.html +0 -185
  59. data/doc/MaxCube/Messages/TCP/Serializer/MessageM.html +0 -428
  60. data/doc/MaxCube/Messages/TCP/Serializer/MessageN.html +0 -209
  61. data/doc/MaxCube/Messages/TCP/Serializer/MessageQ.html +0 -185
  62. data/doc/MaxCube/Messages/TCP/Serializer/MessageS.html +0 -1168
  63. data/doc/MaxCube/Messages/TCP/Serializer/MessageT.html +0 -240
  64. data/doc/MaxCube/Messages/TCP/Serializer/MessageU.html +0 -206
  65. data/doc/MaxCube/Messages/TCP/Serializer/MessageZ.html +0 -252
  66. data/doc/MaxCube/Messages/UDP.html +0 -164
  67. data/doc/MaxCube/Messages/UDP/Handler.html +0 -832
  68. data/doc/MaxCube/Messages/UDP/Parser.html +0 -609
  69. data/doc/MaxCube/Messages/UDP/Parser/MessageH.html +0 -218
  70. data/doc/MaxCube/Messages/UDP/Parser/MessageI.html +0 -215
  71. data/doc/MaxCube/Messages/UDP/Parser/MessageN.html +0 -226
  72. data/doc/MaxCube/Messages/UDP/Serializer.html +0 -484
  73. data/doc/MaxCube/Network.html +0 -167
  74. data/doc/MaxCube/Network/TCP.html +0 -150
  75. data/doc/MaxCube/Network/TCP/Client.html +0 -1930
  76. data/doc/MaxCube/Network/TCP/Client/Commands.html +0 -2457
  77. data/doc/MaxCube/Network/TCP/SampleServer.html +0 -910
  78. data/doc/MaxCube/Network/UDP.html +0 -150
  79. data/doc/MaxCube/Network/UDP/Client.html +0 -518
  80. data/doc/MaxCube/Network/UDP/SampleSocket.html +0 -628
  81. data/doc/MaxCube/Runner.html +0 -355
  82. data/doc/_index.html +0 -518
  83. data/doc/class_list.html +0 -51
  84. data/doc/css/common.css +0 -1
  85. data/doc/css/full_list.css +0 -58
  86. data/doc/css/style.css +0 -499
  87. data/doc/file.README.html +0 -140
  88. data/doc/file_list.html +0 -56
  89. data/doc/frames.html +0 -17
  90. data/doc/index.html +0 -140
  91. data/doc/js/app.js +0 -248
  92. data/doc/js/full_list.js +0 -216
  93. data/doc/js/jquery.js +0 -4
  94. data/doc/method_list.html +0 -1699
  95. data/doc/top-level-namespace.html +0 -110
@@ -1,701 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Module: MaxCube::Messages::Serializer
8
-
9
- &mdash; Documentation by YARD 0.9.12
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- pathId = "MaxCube::Messages::Serializer";
19
- relpath = '../../';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="../../class_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="../../_index.html">Index (S)</a> &raquo;
40
- <span class='title'><span class='object_link'><a href="../../MaxCube.html" title="MaxCube (module)">MaxCube</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Messages.html" title="MaxCube::Messages (module)">Messages</a></span></span>
41
- &raquo;
42
- <span class="title">Serializer</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="../../class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <div id="content"><h1>Module: MaxCube::Messages::Serializer
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
-
70
-
71
-
72
-
73
-
74
- <dl>
75
- <dt>Includes:</dt>
76
- <dd><span class='object_link'><a href="Handler.html" title="MaxCube::Messages::Handler (module)">Handler</a></span></dd>
77
- </dl>
78
-
79
-
80
-
81
-
82
- <dl>
83
- <dt>Included in:</dt>
84
- <dd><span class='object_link'><a href="TCP/Serializer.html" title="MaxCube::Messages::TCP::Serializer (class)">TCP::Serializer</a></span>, <span class='object_link'><a href="UDP/Serializer.html" title="MaxCube::Messages::UDP::Serializer (class)">UDP::Serializer</a></span></dd>
85
- </dl>
86
-
87
-
88
-
89
- <dl>
90
- <dt>Defined in:</dt>
91
- <dd>lib/maxcube/messages/serializer.rb</dd>
92
- </dl>
93
-
94
- </div>
95
-
96
- <h2>Overview</h2><div class="docstring">
97
- <div class="discussion">
98
-
99
- <p>This module provides methods connected to message serializing only (i.e.
100
- direction client -&gt; Cube).</p>
101
-
102
-
103
- </div>
104
- </div>
105
- <div class="tags">
106
-
107
-
108
- </div>
109
-
110
-
111
- <h2>Constant Summary</h2>
112
-
113
- <h3 class="inherited">Constants included
114
- from <span class='object_link'><a href="Handler.html" title="MaxCube::Messages::Handler (module)">Handler</a></span></h3>
115
- <p class="inherited"><span class='object_link'><a href="Handler.html#PACK_FORMAT-constant" title="MaxCube::Messages::Handler::PACK_FORMAT (constant)">Handler::PACK_FORMAT</a></span></p>
116
-
117
-
118
-
119
- <h3 class="inherited">Constants included
120
- from <span class='object_link'><a href="../Messages.html" title="MaxCube::Messages (module)">MaxCube::Messages</a></span></h3>
121
- <p class="inherited"><span class='object_link'><a href="../Messages.html#DAYS_OF_WEEK-constant" title="MaxCube::Messages::DAYS_OF_WEEK (constant)">DAYS_OF_WEEK</a></span>, <span class='object_link'><a href="../Messages.html#DEVICE_MODE-constant" title="MaxCube::Messages::DEVICE_MODE (constant)">DEVICE_MODE</a></span>, <span class='object_link'><a href="../Messages.html#DEVICE_TYPE-constant" title="MaxCube::Messages::DEVICE_TYPE (constant)">DEVICE_TYPE</a></span></p>
122
-
123
-
124
-
125
-
126
-
127
-
128
- <h2>
129
- Instance Method Summary
130
- <small><a href="#" class="summary_toggle">collapse</a></small>
131
- </h2>
132
-
133
- <ul class="summary">
134
-
135
- <li class="public ">
136
- <span class="summary_signature">
137
-
138
- <a href="#serialize-instance_method" title="#serialize (instance method)">#<strong>serialize</strong>(*args, esize: 0, size: 0, count: 0) &#x21d2; String </a>
139
-
140
-
141
-
142
- </span>
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
- <span class="summary_desc"><div class='inline'>
153
- <p>Serializes input <code>args</code> into String, with optional implicit
154
- conversion from integer into binary string (using <span class='object_link'><a href="Handler.html#PACK_FORMAT-constant" title="MaxCube::Messages::Handler::PACK_FORMAT (constant)">Handler::PACK_FORMAT</a></span>).</p>
155
- </div></span>
156
-
157
- </li>
158
-
159
-
160
- <li class="private ">
161
- <span class="summary_signature">
162
-
163
- <a href="#serialize_bounds-instance_method" title="#serialize_bounds (instance method)">#<strong>serialize_bounds</strong>(args, esize: 0, size: 0, count: 0) &#x21d2; [count, subcount, subsize] </a>
164
-
165
-
166
-
167
- </span>
168
-
169
-
170
-
171
- <span class="note title private">private</span>
172
-
173
-
174
-
175
-
176
-
177
- <span class="summary_desc"><div class='inline'>
178
- <p>Helper method called by <span class='object_link'><a href="#serialize-instance_method" title="MaxCube::Messages::Serializer#serialize (method)">#serialize</a></span> that evaluates necessary counts and
179
- sizes for purposes of integer elements conversion in loop.</p>
180
- </div></span>
181
-
182
- </li>
183
-
184
-
185
- <li class="public ">
186
- <span class="summary_signature">
187
-
188
- <a href="#serialize_hash_body-instance_method" title="#serialize_hash_body (instance method)">#<strong>serialize_hash_body</strong>(hash, serializer_type) &#x21d2; String </a>
189
-
190
-
191
-
192
- </span>
193
-
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
- <span class="summary_desc"><div class='inline'>
203
- <p>Serializes message body, i.e.</p>
204
- </div></span>
205
-
206
- </li>
207
-
208
-
209
- <li class="public ">
210
- <span class="summary_signature">
211
-
212
- <a href="#write-instance_method" title="#write (instance method)">#<strong>write</strong>(*args, esize: 0, size: 0, count: 0) &#x21d2; Object </a>
213
-
214
-
215
-
216
- </span>
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
- <span class="summary_desc"><div class='inline'>
227
- <p>It serializes <code>args</code> with <span class='object_link'><a href="#serialize-instance_method" title="MaxCube::Messages::Serializer#serialize (method)">#serialize</a></span> and writes it into
228
- internal <code>IO</code> variable.</p>
229
- </div></span>
230
-
231
- </li>
232
-
233
-
234
- </ul>
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
- <h3 class="inherited">Methods included from <span class='object_link'><a href="Handler.html" title="MaxCube::Messages::Handler (module)">Handler</a></span></h3>
247
- <p class="inherited"><span class='object_link'><a href="Handler.html#check_data_type-instance_method" title="MaxCube::Messages::Handler#check_data_type (method)">#check_data_type</a></span>, <span class='object_link'><a href="Handler.html#check_hash-instance_method" title="MaxCube::Messages::Handler#check_hash (method)">#check_hash</a></span>, <span class='object_link'><a href="Handler.html#check_hash_keys-instance_method" title="MaxCube::Messages::Handler#check_hash_keys (method)">#check_hash_keys</a></span>, <span class='object_link'><a href="Handler.html#check_hash_msg_type-instance_method" title="MaxCube::Messages::Handler#check_hash_msg_type (method)">#check_hash_msg_type</a></span>, <span class='object_link'><a href="Handler.html#check_hash_values-instance_method" title="MaxCube::Messages::Handler#check_hash_values (method)">#check_hash_values</a></span>, <span class='object_link'><a href="Handler.html#check_msg-instance_method" title="MaxCube::Messages::Handler#check_msg (method)">#check_msg</a></span>, <span class='object_link'><a href="Handler.html#check_msg_msg_type-instance_method" title="MaxCube::Messages::Handler#check_msg_msg_type (method)">#check_msg_msg_type</a></span>, <span class='object_link'><a href="Handler.html#check_msg_part_lengths-instance_method" title="MaxCube::Messages::Handler#check_msg_part_lengths (method)">#check_msg_part_lengths</a></span>, <span class='object_link'><a href="Handler.html#check_msg_type-instance_method" title="MaxCube::Messages::Handler#check_msg_type (method)">#check_msg_type</a></span>, <span class='object_link'><a href="Handler.html#decode-instance_method" title="MaxCube::Messages::Handler#decode (method)">#decode</a></span>, <span class='object_link'><a href="Handler.html#encode-instance_method" title="MaxCube::Messages::Handler#encode (method)">#encode</a></span>, <span class='object_link'><a href="Handler.html#maybe_check_valid_hash_keys-instance_method" title="MaxCube::Messages::Handler#maybe_check_valid_hash_keys (method)">#maybe_check_valid_hash_keys</a></span>, <span class='object_link'><a href="Handler.html#maybe_check_valid_msg_type-instance_method" title="MaxCube::Messages::Handler#maybe_check_valid_msg_type (method)">#maybe_check_valid_msg_type</a></span>, <span class='object_link'><a href="Handler.html#msg_type_hash_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_hash_keys (method)">#msg_type_hash_keys</a></span>, <span class='object_link'><a href="Handler.html#msg_type_hash_opt_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_hash_opt_keys (method)">#msg_type_hash_opt_keys</a></span>, <span class='object_link'><a href="Handler.html#msg_type_which_hash_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_which_hash_keys (method)">#msg_type_which_hash_keys</a></span>, <span class='object_link'><a href="Handler.html#msg_types-instance_method" title="MaxCube::Messages::Handler#msg_types (method)">#msg_types</a></span>, <span class='object_link'><a href="Handler.html#valid_data_type-instance_method" title="MaxCube::Messages::Handler#valid_data_type (method)">#valid_data_type</a></span>, <span class='object_link'><a href="Handler.html#valid_hash-instance_method" title="MaxCube::Messages::Handler#valid_hash (method)">#valid_hash</a></span>, <span class='object_link'><a href="Handler.html#valid_hash_keys-instance_method" title="MaxCube::Messages::Handler#valid_hash_keys (method)">#valid_hash_keys</a></span>, <span class='object_link'><a href="Handler.html#valid_hash_msg_type-instance_method" title="MaxCube::Messages::Handler#valid_hash_msg_type (method)">#valid_hash_msg_type</a></span>, <span class='object_link'><a href="Handler.html#valid_hash_values-instance_method" title="MaxCube::Messages::Handler#valid_hash_values (method)">#valid_hash_values</a></span>, <span class='object_link'><a href="Handler.html#valid_msg-instance_method" title="MaxCube::Messages::Handler#valid_msg (method)">#valid_msg</a></span>, <span class='object_link'><a href="Handler.html#valid_msg_msg_type-instance_method" title="MaxCube::Messages::Handler#valid_msg_msg_type (method)">#valid_msg_msg_type</a></span>, <span class='object_link'><a href="Handler.html#valid_msg_part_lengths-instance_method" title="MaxCube::Messages::Handler#valid_msg_part_lengths (method)">#valid_msg_part_lengths</a></span>, <span class='object_link'><a href="Handler.html#valid_msg_type-instance_method" title="MaxCube::Messages::Handler#valid_msg_type (method)">#valid_msg_type</a></span></p>
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
- <h3 class="inherited">Methods included from <span class='object_link'><a href="../Messages.html" title="MaxCube::Messages (module)">MaxCube::Messages</a></span></h3>
258
- <p class="inherited"><span class='object_link'><a href="../Messages.html#ary_elem-instance_method" title="MaxCube::Messages#ary_elem (method)">#ary_elem</a></span>, <span class='object_link'><a href="../Messages.html#ary_elem_id-instance_method" title="MaxCube::Messages#ary_elem_id (method)">#ary_elem_id</a></span>, <span class='object_link'><a href="../Messages.html#conv_args-instance_method" title="MaxCube::Messages#conv_args (method)">#conv_args</a></span>, <span class='object_link'><a href="../Messages.html#day_of_week-instance_method" title="MaxCube::Messages#day_of_week (method)">#day_of_week</a></span>, <span class='object_link'><a href="../Messages.html#day_of_week_id-instance_method" title="MaxCube::Messages#day_of_week_id (method)">#day_of_week_id</a></span>, <span class='object_link'><a href="../Messages.html#device_mode-instance_method" title="MaxCube::Messages#device_mode (method)">#device_mode</a></span>, <span class='object_link'><a href="../Messages.html#device_mode_id-instance_method" title="MaxCube::Messages#device_mode_id (method)">#device_mode_id</a></span>, <span class='object_link'><a href="../Messages.html#device_type-instance_method" title="MaxCube::Messages#device_type (method)">#device_type</a></span>, <span class='object_link'><a href="../Messages.html#device_type_id-instance_method" title="MaxCube::Messages#device_type_id (method)">#device_type_id</a></span>, <span class='object_link'><a href="../Messages.html#to_bool-instance_method" title="MaxCube::Messages#to_bool (method)">#to_bool</a></span>, <span class='object_link'><a href="../Messages.html#to_bools-instance_method" title="MaxCube::Messages#to_bools (method)">#to_bools</a></span>, <span class='object_link'><a href="../Messages.html#to_datetime-instance_method" title="MaxCube::Messages#to_datetime (method)">#to_datetime</a></span>, <span class='object_link'><a href="../Messages.html#to_datetimes-instance_method" title="MaxCube::Messages#to_datetimes (method)">#to_datetimes</a></span>, <span class='object_link'><a href="../Messages.html#to_float-instance_method" title="MaxCube::Messages#to_float (method)">#to_float</a></span>, <span class='object_link'><a href="../Messages.html#to_floats-instance_method" title="MaxCube::Messages#to_floats (method)">#to_floats</a></span>, <span class='object_link'><a href="../Messages.html#to_int-instance_method" title="MaxCube::Messages#to_int (method)">#to_int</a></span>, <span class='object_link'><a href="../Messages.html#to_ints-instance_method" title="MaxCube::Messages#to_ints (method)">#to_ints</a></span></p>
259
-
260
-
261
- <div id="instance_method_details" class="method_details_list">
262
- <h2>Instance Method Details</h2>
263
-
264
-
265
- <div class="method_details first">
266
- <h3 class="signature first" id="serialize-instance_method">
267
-
268
- #<strong>serialize</strong>(*args, esize: 0, size: 0, count: 0) &#x21d2; <tt>String</tt>
269
-
270
-
271
-
272
-
273
-
274
- </h3><div class="docstring">
275
- <div class="discussion">
276
-
277
- <p>Serializes input <code>args</code> into String, with optional implicit
278
- conversion from integer into binary string (using <span class='object_link'><a href="Handler.html#PACK_FORMAT-constant" title="MaxCube::Messages::Handler::PACK_FORMAT (constant)">Handler::PACK_FORMAT</a></span>). In any
279
- case, String elements are serialized as they are.</p>
280
-
281
-
282
- </div>
283
- </div>
284
- <div class="tags">
285
- <p class="tag_title">Parameters:</p>
286
- <ul class="param">
287
-
288
- <li>
289
-
290
- <span class='name'>args</span>
291
-
292
-
293
- <span class='type'>(<tt>Array&lt;String, Integer&gt;</tt>)</span>
294
-
295
-
296
-
297
- &mdash;
298
- <div class='inline'>
299
- <p>input arguments.</p>
300
- </div>
301
-
302
- </li>
303
-
304
- <li>
305
-
306
- <span class='name'>esize</span>
307
-
308
-
309
- <span class='type'>(<tt>Integer</tt>)</span>
310
-
311
-
312
-
313
- &mdash;
314
- <div class='inline'>
315
- <p>output size of binary string of each converted integer element. Nonzero
316
- value enables conversion of integers into binary strings. This value is
317
- sufficient alone, but it is not suitable in cases when more elements are to
318
- be grouped together - <code>esize</code> is in interval (0,1) in this case.
319
- Output count (<code>count</code>) is assumed to be the same with input
320
- count.</p>
321
- </div>
322
-
323
- </li>
324
-
325
- <li>
326
-
327
- <span class='name'>size</span>
328
-
329
-
330
- <span class='type'>(<tt>Integer</tt>)</span>
331
-
332
-
333
-
334
- &mdash;
335
- <div class='inline'>
336
- <p>total output size of binary string of converted integer elements. Nonzero
337
- value enables conversion of integers into binary strings. This value is
338
- sufficient alone if output count is same with input count.</p>
339
- </div>
340
-
341
- </li>
342
-
343
- <li>
344
-
345
- <span class='name'>count</span>
346
-
347
-
348
- <span class='type'>(<tt>Integer</tt>)</span>
349
-
350
-
351
-
352
- &mdash;
353
- <div class='inline'>
354
- <p>output count of converted integer elements. <code>size</code> must be
355
- specified. 0 means same count as input count. It is suitable for cases when
356
- input and output counts differ.</p>
357
- </div>
358
-
359
- </li>
360
-
361
- </ul>
362
-
363
- <p class="tag_title">Returns:</p>
364
- <ul class="return">
365
-
366
- <li>
367
-
368
-
369
- <span class='type'>(<tt>String</tt>)</span>
370
-
371
-
372
-
373
- &mdash;
374
- <div class='inline'>
375
- <p>serialized <code>args</code>. If conversion was enabled, it may contain
376
- binary data.</p>
377
- </div>
378
-
379
- </li>
380
-
381
- </ul>
382
-
383
- </div><table class="source_code">
384
- <tr>
385
- <td>
386
- <pre class="lines">
387
-
388
-
389
- 32
390
- 33
391
- 34
392
- 35
393
- 36
394
- 37
395
- 38
396
- 39
397
- 40
398
- 41
399
- 42
400
- 43
401
- 44
402
- 45
403
- 46
404
- 47
405
- 48
406
- 49
407
- 50</pre>
408
- </td>
409
- <td>
410
- <pre class="code"><span class="info file"># File 'lib/maxcube/messages/serializer.rb', line 32</span>
411
-
412
- <span class='kw'>def</span> <span class='id identifier rubyid_serialize'>serialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='label'>esize:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>size:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>count:</span> <span class='int'>0</span><span class='rparen'>)</span>
413
- <span class='kw'>return</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span> <span class='kw'>if</span> <span class='id identifier rubyid_size'>size</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_esize'>esize</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
414
-
415
- <span class='id identifier rubyid_count'>count</span><span class='comma'>,</span> <span class='id identifier rubyid_subcount'>subcount</span><span class='comma'>,</span> <span class='id identifier rubyid_subsize'>subsize</span> <span class='op'>=</span> <span class='id identifier rubyid_serialize_bounds'>serialize_bounds</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span>
416
- <span class='label'>esize:</span> <span class='id identifier rubyid_esize'>esize</span><span class='comma'>,</span>
417
- <span class='label'>size:</span> <span class='id identifier rubyid_size'>size</span><span class='comma'>,</span>
418
- <span class='label'>count:</span> <span class='id identifier rubyid_count'>count</span><span class='rparen'>)</span>
419
- <span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
420
- <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_reverse!'>reverse!</span>
421
- <span class='id identifier rubyid_count'>count</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span>
422
- <span class='id identifier rubyid_str'>str</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span> <span class='kw'>while</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
423
- <span class='id identifier rubyid_substr'>substr</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span><span class='lparen'>(</span><span class='id identifier rubyid_subcount'>subcount</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_pack'>pack</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Handler.html#PACK_FORMAT-constant" title="MaxCube::Messages::Handler::PACK_FORMAT (constant)">PACK_FORMAT</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_subsize'>subsize</span><span class='rbracket'>]</span><span class='rparen'>)</span>
424
- <span class='id identifier rubyid_substr'>substr</span> <span class='op'>=</span> <span class='id identifier rubyid_substr'>substr</span><span class='lbracket'>[</span><span class='int'>1</span><span class='op'>..</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_subsize'>subsize</span> <span class='op'>==</span> <span class='int'>3</span>
425
- <span class='id identifier rubyid_str'>str</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_substr'>substr</span>
426
- <span class='kw'>end</span>
427
- <span class='id identifier rubyid_str'>str</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span> <span class='kw'>until</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
428
-
429
- <span class='id identifier rubyid_str'>str</span>
430
- <span class='kw'>end</span></pre>
431
- </td>
432
- </tr>
433
- </table>
434
- </div>
435
-
436
- <div class="method_details ">
437
- <h3 class="signature " id="serialize_bounds-instance_method">
438
-
439
- #<strong>serialize_bounds</strong>(args, esize: 0, size: 0, count: 0) &#x21d2; <tt>[count, subcount, subsize]</tt> <span class="extras">(private)</span>
440
-
441
-
442
-
443
-
444
-
445
- </h3><div class="docstring">
446
- <div class="discussion">
447
-
448
- <p>Helper method called by <span class='object_link'><a href="#serialize-instance_method" title="MaxCube::Messages::Serializer#serialize (method)">#serialize</a></span> that evaluates necessary counts and
449
- sizes for purposes of integer elements conversion in loop.</p>
450
-
451
-
452
- </div>
453
- </div>
454
- <div class="tags">
455
-
456
- <p class="tag_title">Returns:</p>
457
- <ul class="return">
458
-
459
- <li>
460
-
461
-
462
- <span class='type'>(<tt>[count, subcount, subsize]</tt>)</span>
463
-
464
-
465
-
466
- &mdash;
467
- <div class='inline'>
468
- <p><code>count</code> is output count of converted elements (0 if
469
- <code>args</code> array is empty), <code>subcount</code> is number of
470
- elements to be converted together in each step, <code>subsize</code> is
471
- output size in bytes to which to convert elements in each step into.</p>
472
- </div>
473
-
474
- </li>
475
-
476
- </ul>
477
-
478
- </div><table class="source_code">
479
- <tr>
480
- <td>
481
- <pre class="lines">
482
-
483
-
484
- 90
485
- 91
486
- 92
487
- 93
488
- 94
489
- 95
490
- 96
491
- 97
492
- 98
493
- 99
494
- 100
495
- 101
496
- 102
497
- 103
498
- 104</pre>
499
- </td>
500
- <td>
501
- <pre class="code"><span class="info file"># File 'lib/maxcube/messages/serializer.rb', line 90</span>
502
-
503
- <span class='kw'>def</span> <span class='id identifier rubyid_serialize_bounds'>serialize_bounds</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='label'>esize:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>size:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>count:</span> <span class='int'>0</span><span class='rparen'>)</span>
504
- <span class='id identifier rubyid_icount'>icount</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>-</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
505
- <span class='kw'>return</span> <span class='int'>0</span> <span class='kw'>if</span> <span class='id identifier rubyid_icount'>icount</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
506
- <span class='kw'>if</span> <span class='id identifier rubyid_esize'>esize</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
507
- <span class='id identifier rubyid_count'>count</span> <span class='op'>=</span> <span class='id identifier rubyid_icount'>icount</span> <span class='kw'>if</span> <span class='id identifier rubyid_count'>count</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
508
- <span class='id identifier rubyid_subsize'>subsize</span> <span class='op'>=</span> <span class='id identifier rubyid_size'>size</span> <span class='op'>/</span> <span class='id identifier rubyid_count'>count</span>
509
- <span class='kw'>else</span>
510
- <span class='id identifier rubyid_size'>size</span> <span class='op'>=</span> <span class='id identifier rubyid_icount'>icount</span> <span class='op'>*</span> <span class='id identifier rubyid_esize'>esize</span>
511
- <span class='id identifier rubyid_count'>count</span> <span class='op'>=</span> <span class='id identifier rubyid_size'>size</span> <span class='op'>/</span> <span class='id identifier rubyid_esize'>esize</span>
512
- <span class='id identifier rubyid_subsize'>subsize</span> <span class='op'>=</span> <span class='id identifier rubyid_esize'>esize</span>
513
- <span class='kw'>end</span>
514
- <span class='id identifier rubyid_subcount'>subcount</span> <span class='op'>=</span> <span class='id identifier rubyid_icount'>icount</span> <span class='op'>/</span> <span class='id identifier rubyid_count'>count</span>
515
-
516
- <span class='lbracket'>[</span><span class='id identifier rubyid_count'>count</span><span class='comma'>,</span> <span class='id identifier rubyid_subcount'>subcount</span><span class='comma'>,</span> <span class='id identifier rubyid_subsize'>subsize</span><span class='rbracket'>]</span>
517
- <span class='kw'>end</span></pre>
518
- </td>
519
- </tr>
520
- </table>
521
- </div>
522
-
523
- <div class="method_details ">
524
- <h3 class="signature " id="serialize_hash_body-instance_method">
525
-
526
- #<strong>serialize_hash_body</strong>(hash, serializer_type) &#x21d2; <tt>String</tt>
527
-
528
-
529
-
530
-
531
-
532
- </h3><div class="docstring">
533
- <div class="discussion">
534
-
535
- <p>Serializes message body, i.e. message head has been already serialized. It
536
- dynamically calls method corresponding to message and serializer type. If
537
- message type is not implemented yet, it is unclear how to serialize the
538
- <code>hash</code>, so an exception is raised.</p>
539
-
540
-
541
- </div>
542
- </div>
543
- <div class="tags">
544
- <p class="tag_title">Parameters:</p>
545
- <ul class="param">
546
-
547
- <li>
548
-
549
- <span class='name'>hash</span>
550
-
551
-
552
- <span class='type'>(<tt>Hash</tt>)</span>
553
-
554
-
555
-
556
- &mdash;
557
- <div class='inline'>
558
- <p>hash with message contents to serialize.</p>
559
- </div>
560
-
561
- </li>
562
-
563
- <li>
564
-
565
- <span class='name'>serializer_type</span>
566
-
567
-
568
- <span class='type'>(<tt>String</tt>)</span>
569
-
570
-
571
-
572
- &mdash;
573
- <div class='inline'>
574
- <p>serializer type contained in method identifiers.</p>
575
- </div>
576
-
577
- </li>
578
-
579
- </ul>
580
-
581
- <p class="tag_title">Returns:</p>
582
- <ul class="return">
583
-
584
- <li>
585
-
586
-
587
- <span class='type'>(<tt>String</tt>)</span>
588
-
589
-
590
-
591
- &mdash;
592
- <div class='inline'>
593
- <p>resulting message string.</p>
594
- </div>
595
-
596
- </li>
597
-
598
- </ul>
599
- <p class="tag_title">Raises:</p>
600
- <ul class="raise">
601
-
602
- <li>
603
-
604
-
605
- <span class='type'>(<tt><span class='object_link'><a href="InvalidMessageType.html" title="MaxCube::Messages::InvalidMessageType (class)">InvalidMessageType</a></span></tt>)</span>
606
-
607
-
608
-
609
- &mdash;
610
- <div class='inline'>
611
- <p>if the message type is not implemented yet.</p>
612
- </div>
613
-
614
- </li>
615
-
616
- </ul>
617
-
618
- </div><table class="source_code">
619
- <tr>
620
- <td>
621
- <pre class="lines">
622
-
623
-
624
- 70
625
- 71
626
- 72
627
- 73
628
- 74
629
- 75
630
- 76</pre>
631
- </td>
632
- <td>
633
- <pre class="code"><span class="info file"># File 'lib/maxcube/messages/serializer.rb', line 70</span>
634
-
635
- <span class='kw'>def</span> <span class='id identifier rubyid_serialize_hash_body'>serialize_hash_body</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='id identifier rubyid_serializer_type'>serializer_type</span><span class='rparen'>)</span>
636
- <span class='id identifier rubyid_method_str'>method_str</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>serialize_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serializer_type'>serializer_type</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='ivar'>@msg_type</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
637
- <span class='kw'>return</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method_str'>method_str</span><span class='comma'>,</span> <span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method_str'>method_str</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
638
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="InvalidMessageType.html" title="MaxCube::Messages::InvalidMessageType (class)">InvalidMessageType</a></span></span>
639
- <span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@msg_type</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>serialization of message type</span><span class='tstring_end'>&#39;</span></span> \
640
- <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'> is not implemented (yet)</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
641
- <span class='kw'>end</span></pre>
642
- </td>
643
- </tr>
644
- </table>
645
- </div>
646
-
647
- <div class="method_details ">
648
- <h3 class="signature " id="write-instance_method">
649
-
650
- #<strong>write</strong>(*args, esize: 0, size: 0, count: 0) &#x21d2; <tt>Object</tt>
651
-
652
-
653
-
654
-
655
-
656
- </h3><div class="docstring">
657
- <div class="discussion">
658
-
659
- <p>It serializes <code>args</code> with <span class='object_link'><a href="#serialize-instance_method" title="MaxCube::Messages::Serializer#serialize (method)">#serialize</a></span> and writes it into
660
- internal <code>IO</code> variable.</p>
661
-
662
-
663
- </div>
664
- </div>
665
- <div class="tags">
666
-
667
-
668
- </div><table class="source_code">
669
- <tr>
670
- <td>
671
- <pre class="lines">
672
-
673
-
674
- 54
675
- 55
676
- 56</pre>
677
- </td>
678
- <td>
679
- <pre class="code"><span class="info file"># File 'lib/maxcube/messages/serializer.rb', line 54</span>
680
-
681
- <span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='label'>esize:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>size:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>count:</span> <span class='int'>0</span><span class='rparen'>)</span>
682
- <span class='ivar'>@io</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_serialize'>serialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='label'>esize:</span> <span class='id identifier rubyid_esize'>esize</span><span class='comma'>,</span> <span class='label'>size:</span> <span class='id identifier rubyid_size'>size</span><span class='comma'>,</span> <span class='label'>count:</span> <span class='id identifier rubyid_count'>count</span><span class='rparen'>)</span><span class='rparen'>)</span>
683
- <span class='kw'>end</span></pre>
684
- </td>
685
- </tr>
686
- </table>
687
- </div>
688
-
689
- </div>
690
-
691
- </div>
692
-
693
- <div id="footer">
694
- Generated on Fri Feb 16 13:44:01 2018 by
695
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
696
- 0.9.12 (ruby-2.5.0).
697
- </div>
698
-
699
- </div>
700
- </body>
701
- </html>