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.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/data/save/20180214-2023/recv.data +12 -0
- data/data/save/20180214-2023/recv.yaml +152 -0
- data/data/save/20180214-2023/sent.data +10 -0
- data/data/save/20180214-2023/sent.yaml +26 -0
- data/data/save/20180214-2230/recv.data +2 -0
- data/data/save/20180214-2230/recv.yaml +68 -0
- data/data/save/20180214-2230/sent.data +1 -0
- data/data/save/20180214-2230/sent.yaml +19 -0
- data/data/save/20180215-0057/recv.data +3 -0
- data/data/save/20180215-0057/recv.yaml +69 -0
- data/data/save/20180215-0057/sent.data +2 -0
- data/data/save/20180215-0057/sent.yaml +22 -0
- data/data/save/20180216-1641/recv.data +4 -0
- data/data/save/20180216-1641/recv.yaml +133 -0
- data/data/save/20180216-1641/sent.data +2 -0
- data/data/save/20180216-1641/sent.yaml +3 -0
- data/lib/maxcube/version.rb +1 -1
- data/maxcube-client.gemspec +5 -6
- data/spec/msg_spec.rb +2117 -0
- data/spec/spec_helper.rb +7 -0
- metadata +21 -75
- data/.gitignore +0 -6
- data/.rubocop.yml +0 -29
- data/.yardopts +0 -1
- data/Gemfile +0 -5
- data/bin/console +0 -8
- data/bin/maxcube-client +0 -6
- data/bin/sample_server +0 -13
- data/bin/sample_socket +0 -13
- data/bin/setup +0 -6
- data/doc/MaxCube.html +0 -502
- data/doc/MaxCube/Messages.html +0 -1927
- data/doc/MaxCube/Messages/Handler.html +0 -2912
- data/doc/MaxCube/Messages/InvalidMessage.html +0 -140
- data/doc/MaxCube/Messages/InvalidMessageBody.html +0 -264
- data/doc/MaxCube/Messages/InvalidMessageFormat.html +0 -247
- data/doc/MaxCube/Messages/InvalidMessageLength.html +0 -247
- data/doc/MaxCube/Messages/InvalidMessageType.html +0 -263
- data/doc/MaxCube/Messages/Parser.html +0 -520
- data/doc/MaxCube/Messages/Serializer.html +0 -701
- data/doc/MaxCube/Messages/TCP.html +0 -172
- data/doc/MaxCube/Messages/TCP/Handler.html +0 -1396
- data/doc/MaxCube/Messages/TCP/Parser.html +0 -462
- data/doc/MaxCube/Messages/TCP/Parser/MessageA.html +0 -186
- data/doc/MaxCube/Messages/TCP/Parser/MessageC.html +0 -1077
- data/doc/MaxCube/Messages/TCP/Parser/MessageF.html +0 -206
- data/doc/MaxCube/Messages/TCP/Parser/MessageH.html +0 -338
- data/doc/MaxCube/Messages/TCP/Parser/MessageL.html +0 -535
- data/doc/MaxCube/Messages/TCP/Parser/MessageM.html +0 -510
- data/doc/MaxCube/Messages/TCP/Parser/MessageN.html +0 -226
- data/doc/MaxCube/Messages/TCP/Parser/MessageS.html +0 -225
- data/doc/MaxCube/Messages/TCP/Serializer.html +0 -460
- data/doc/MaxCube/Messages/TCP/Serializer/MessageA.html +0 -186
- data/doc/MaxCube/Messages/TCP/Serializer/MessageC.html +0 -185
- data/doc/MaxCube/Messages/TCP/Serializer/MessageF.html +0 -206
- data/doc/MaxCube/Messages/TCP/Serializer/MessageL.html +0 -185
- data/doc/MaxCube/Messages/TCP/Serializer/MessageM.html +0 -428
- data/doc/MaxCube/Messages/TCP/Serializer/MessageN.html +0 -209
- data/doc/MaxCube/Messages/TCP/Serializer/MessageQ.html +0 -185
- data/doc/MaxCube/Messages/TCP/Serializer/MessageS.html +0 -1168
- data/doc/MaxCube/Messages/TCP/Serializer/MessageT.html +0 -240
- data/doc/MaxCube/Messages/TCP/Serializer/MessageU.html +0 -206
- data/doc/MaxCube/Messages/TCP/Serializer/MessageZ.html +0 -252
- data/doc/MaxCube/Messages/UDP.html +0 -164
- data/doc/MaxCube/Messages/UDP/Handler.html +0 -832
- data/doc/MaxCube/Messages/UDP/Parser.html +0 -609
- data/doc/MaxCube/Messages/UDP/Parser/MessageH.html +0 -218
- data/doc/MaxCube/Messages/UDP/Parser/MessageI.html +0 -215
- data/doc/MaxCube/Messages/UDP/Parser/MessageN.html +0 -226
- data/doc/MaxCube/Messages/UDP/Serializer.html +0 -484
- data/doc/MaxCube/Network.html +0 -167
- data/doc/MaxCube/Network/TCP.html +0 -150
- data/doc/MaxCube/Network/TCP/Client.html +0 -1930
- data/doc/MaxCube/Network/TCP/Client/Commands.html +0 -2457
- data/doc/MaxCube/Network/TCP/SampleServer.html +0 -910
- data/doc/MaxCube/Network/UDP.html +0 -150
- data/doc/MaxCube/Network/UDP/Client.html +0 -518
- data/doc/MaxCube/Network/UDP/SampleSocket.html +0 -628
- data/doc/MaxCube/Runner.html +0 -355
- data/doc/_index.html +0 -518
- data/doc/class_list.html +0 -51
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -58
- data/doc/css/style.css +0 -499
- data/doc/file.README.html +0 -140
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -17
- data/doc/index.html +0 -140
- data/doc/js/app.js +0 -248
- data/doc/js/full_list.js +0 -216
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1699
- data/doc/top-level-namespace.html +0 -110
@@ -1,2912 +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::Handler
|
8
|
-
|
9
|
-
— 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::Handler";
|
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 (H)</a> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../../MaxCube.html" title="MaxCube (module)">MaxCube</a></span></span> » <span class='title'><span class='object_link'><a href="../Messages.html" title="MaxCube::Messages (module)">Messages</a></span></span>
|
41
|
-
»
|
42
|
-
<span class="title">Handler</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::Handler
|
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="../Messages.html" title="MaxCube::Messages (module)">MaxCube::Messages</a></span></dd>
|
77
|
-
</dl>
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
<dl>
|
83
|
-
<dt>Included in:</dt>
|
84
|
-
<dd><span class='object_link'><a href="Parser.html" title="MaxCube::Messages::Parser (module)">Parser</a></span>, <span class='object_link'><a href="Serializer.html" title="MaxCube::Messages::Serializer (module)">Serializer</a></span>, <span class='object_link'><a href="TCP/Handler.html" title="MaxCube::Messages::TCP::Handler (module)">TCP::Handler</a></span>, <span class='object_link'><a href="UDP/Handler.html" title="MaxCube::Messages::UDP::Handler (module)">UDP::Handler</a></span></dd>
|
85
|
-
</dl>
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<dl>
|
90
|
-
<dt>Defined in:</dt>
|
91
|
-
<dd>lib/maxcube/messages/handler.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 that handles with messages regardless whether
|
100
|
-
it is for parse or serialize purposes. It mostly contains methods that
|
101
|
-
validates (returns Boolean) or checks (raises exception on failure) some
|
102
|
-
part of message.</p>
|
103
|
-
|
104
|
-
|
105
|
-
</div>
|
106
|
-
</div>
|
107
|
-
<div class="tags">
|
108
|
-
|
109
|
-
|
110
|
-
</div>
|
111
|
-
<h2>Constant Summary</h2>
|
112
|
-
<dl class="constants">
|
113
|
-
|
114
|
-
<dt id="PACK_FORMAT-constant" class="">PACK_FORMAT =
|
115
|
-
<div class="docstring">
|
116
|
-
<div class="discussion">
|
117
|
-
|
118
|
-
<p>Format characters to String#unpack and Array#pack, for purposes to convert
|
119
|
-
binary string to integer. Elements are sorted by integer size in bytes.</p>
|
120
|
-
|
121
|
-
|
122
|
-
</div>
|
123
|
-
</div>
|
124
|
-
<div class="tags">
|
125
|
-
|
126
|
-
|
127
|
-
</div>
|
128
|
-
</dt>
|
129
|
-
<dd><pre class="code"><span class='qwords_beg'>%w[</span><span class='tstring_content'>x</span><span class='words_sep'> </span><span class='tstring_content'>C</span><span class='words_sep'> </span><span class='tstring_content'>n</span><span class='words_sep'> </span><span class='tstring_content'>N</span><span class='words_sep'> </span><span class='tstring_content'>N</span><span class='tstring_end'>]</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
130
|
-
|
131
|
-
</dl>
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
<h3 class="inherited">Constants included
|
138
|
-
from <span class='object_link'><a href="../Messages.html" title="MaxCube::Messages (module)">MaxCube::Messages</a></span></h3>
|
139
|
-
<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>
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
<h2>
|
147
|
-
Instance Method Summary
|
148
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
149
|
-
</h2>
|
150
|
-
|
151
|
-
<ul class="summary">
|
152
|
-
|
153
|
-
<li class="public ">
|
154
|
-
<span class="summary_signature">
|
155
|
-
|
156
|
-
<a href="#check_data_type-instance_method" title="#check_data_type (instance method)">#<strong>check_data_type</strong>(raw_data) ⇒ String </a>
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
</span>
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
<span class="summary_desc"><div class='inline'>
|
171
|
-
<p>Checks whether <span class='object_link'><a href="#valid_data_type-instance_method" title="MaxCube::Messages::Handler#valid_data_type (method)">#valid_data_type</a></span> is <code>true</code>.</p>
|
172
|
-
</div></span>
|
173
|
-
|
174
|
-
</li>
|
175
|
-
|
176
|
-
|
177
|
-
<li class="public ">
|
178
|
-
<span class="summary_signature">
|
179
|
-
|
180
|
-
<a href="#check_hash-instance_method" title="#check_hash (instance method)">#<strong>check_hash</strong>(hash) ⇒ Hash </a>
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
</span>
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
<span class="summary_desc"><div class='inline'>
|
195
|
-
<p>As <span class='object_link'><a href="#valid_hash-instance_method" title="MaxCube::Messages::Handler#valid_hash (method)">#valid_hash</a></span>, but raises exception if hash is <em>not</em> valid.</p>
|
196
|
-
</div></span>
|
197
|
-
|
198
|
-
</li>
|
199
|
-
|
200
|
-
|
201
|
-
<li class="public ">
|
202
|
-
<span class="summary_signature">
|
203
|
-
|
204
|
-
<a href="#check_hash_keys-instance_method" title="#check_hash_keys (instance method)">#<strong>check_hash_keys</strong>(hash) ⇒ Hash </a>
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
</span>
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
<span class="summary_desc"><div class='inline'>
|
219
|
-
<p>As <span class='object_link'><a href="#valid_hash_keys-instance_method" title="MaxCube::Messages::Handler#valid_hash_keys (method)">#valid_hash_keys</a></span>, but raises exception if hash is <em>not</em> valid.</p>
|
220
|
-
</div></span>
|
221
|
-
|
222
|
-
</li>
|
223
|
-
|
224
|
-
|
225
|
-
<li class="public ">
|
226
|
-
<span class="summary_signature">
|
227
|
-
|
228
|
-
<a href="#check_hash_msg_type-instance_method" title="#check_hash_msg_type (instance method)">#<strong>check_hash_msg_type</strong>(hash) ⇒ Object </a>
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
</span>
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
<span class="summary_desc"><div class='inline'>
|
243
|
-
<p>Checks whether message type character in hash is valid.</p>
|
244
|
-
</div></span>
|
245
|
-
|
246
|
-
</li>
|
247
|
-
|
248
|
-
|
249
|
-
<li class="public ">
|
250
|
-
<span class="summary_signature">
|
251
|
-
|
252
|
-
<a href="#check_hash_values-instance_method" title="#check_hash_values (instance method)">#<strong>check_hash_values</strong>(hash) ⇒ Hash </a>
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
</span>
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
<span class="summary_desc"><div class='inline'>
|
267
|
-
<p>As <span class='object_link'><a href="#valid_hash_values-instance_method" title="MaxCube::Messages::Handler#valid_hash_values (method)">#valid_hash_values</a></span>, but raises exception if hash values are
|
268
|
-
<em>not</em> valid.</p>
|
269
|
-
</div></span>
|
270
|
-
|
271
|
-
</li>
|
272
|
-
|
273
|
-
|
274
|
-
<li class="public ">
|
275
|
-
<span class="summary_signature">
|
276
|
-
|
277
|
-
<a href="#check_msg-instance_method" title="#check_msg (instance method)">#<strong>check_msg</strong>(msg) ⇒ Object </a>
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
</span>
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
<span class="summary_desc"><div class='inline'>
|
292
|
-
<p>As <span class='object_link'><a href="#valid_msg-instance_method" title="MaxCube::Messages::Handler#valid_msg (method)">#valid_msg</a></span>, but raises exception if message is invalid.</p>
|
293
|
-
</div></span>
|
294
|
-
|
295
|
-
</li>
|
296
|
-
|
297
|
-
|
298
|
-
<li class="public ">
|
299
|
-
<span class="summary_signature">
|
300
|
-
|
301
|
-
<a href="#check_msg_msg_type-instance_method" title="#check_msg_msg_type (instance method)">#<strong>check_msg_msg_type</strong>(msg) ⇒ Object </a>
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
</span>
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
<span class="summary_desc"><div class='inline'>
|
316
|
-
<p>Checks whether message type character of message is valid.</p>
|
317
|
-
</div></span>
|
318
|
-
|
319
|
-
</li>
|
320
|
-
|
321
|
-
|
322
|
-
<li class="private ">
|
323
|
-
<span class="summary_signature">
|
324
|
-
|
325
|
-
<a href="#check_msg_part_lengths-instance_method" title="#check_msg_part_lengths (instance method)">#<strong>check_msg_part_lengths</strong>(lengths, *args) ⇒ Array </a>
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
</span>
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
<span class="note title private">private</span>
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
<span class="summary_desc"><div class='inline'>
|
340
|
-
<p>As <span class='object_link'><a href="#valid_msg_part_lengths-instance_method" title="MaxCube::Messages::Handler#valid_msg_part_lengths (method)">#valid_msg_part_lengths</a></span>, but raises exception on failure.</p>
|
341
|
-
</div></span>
|
342
|
-
|
343
|
-
</li>
|
344
|
-
|
345
|
-
|
346
|
-
<li class="public ">
|
347
|
-
<span class="summary_signature">
|
348
|
-
|
349
|
-
<a href="#check_msg_type-instance_method" title="#check_msg_type (instance method)">#<strong>check_msg_type</strong>(msg_type) ⇒ String </a>
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
</span>
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
<span class="summary_desc"><div class='inline'>
|
364
|
-
<p>Checks whether message type character is valid.</p>
|
365
|
-
</div></span>
|
366
|
-
|
367
|
-
</li>
|
368
|
-
|
369
|
-
|
370
|
-
<li class="private ">
|
371
|
-
<span class="summary_signature">
|
372
|
-
|
373
|
-
<a href="#decode-instance_method" title="#decode (instance method)">#<strong>decode</strong>(data) ⇒ String </a>
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
</span>
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
<span class="note title private">private</span>
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
<span class="summary_desc"><div class='inline'>
|
388
|
-
<p>Decodes input data with only printable characters to binary data using
|
389
|
-
Base64#decode64.</p>
|
390
|
-
</div></span>
|
391
|
-
|
392
|
-
</li>
|
393
|
-
|
394
|
-
|
395
|
-
<li class="private ">
|
396
|
-
<span class="summary_signature">
|
397
|
-
|
398
|
-
<a href="#encode-instance_method" title="#encode (instance method)">#<strong>encode</strong>(data) ⇒ String </a>
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
</span>
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
<span class="note title private">private</span>
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
<span class="summary_desc"><div class='inline'>
|
413
|
-
<p>Encodes input binary data to only printable characters using
|
414
|
-
Base64#strict_encode64.</p>
|
415
|
-
</div></span>
|
416
|
-
|
417
|
-
</li>
|
418
|
-
|
419
|
-
|
420
|
-
<li class="private ">
|
421
|
-
<span class="summary_signature">
|
422
|
-
|
423
|
-
<a href="#maybe_check_valid_hash_keys-instance_method" title="#maybe_check_valid_hash_keys (instance method)">#<strong>maybe_check_valid_hash_keys</strong>(hash, check) ⇒ Boolean </a>
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
</span>
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
<span class="note title private">private</span>
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
<span class="summary_desc"><div class='inline'>
|
438
|
-
<p>Helper method that is called by <span class='object_link'><a href="#valid_hash_keys-instance_method" title="MaxCube::Messages::Handler#valid_hash_keys (method)">#valid_hash_keys</a></span> or <span class='object_link'><a href="#check_hash_keys-instance_method" title="MaxCube::Messages::Handler#check_hash_keys (method)">#check_hash_keys</a></span>.</p>
|
439
|
-
</div></span>
|
440
|
-
|
441
|
-
</li>
|
442
|
-
|
443
|
-
|
444
|
-
<li class="private ">
|
445
|
-
<span class="summary_signature">
|
446
|
-
|
447
|
-
<a href="#maybe_check_valid_msg_type-instance_method" title="#maybe_check_valid_msg_type (instance method)">#<strong>maybe_check_valid_msg_type</strong>(msg_type, check) ⇒ Object </a>
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
</span>
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
<span class="note title private">private</span>
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
<span class="summary_desc"><div class='inline'>
|
462
|
-
<p>Helper method that is called by <span class='object_link'><a href="#valid_msg_type-instance_method" title="MaxCube::Messages::Handler#valid_msg_type (method)">#valid_msg_type</a></span> or <span class='object_link'><a href="#check_msg_type-instance_method" title="MaxCube::Messages::Handler#check_msg_type (method)">#check_msg_type</a></span>.</p>
|
463
|
-
</div></span>
|
464
|
-
|
465
|
-
</li>
|
466
|
-
|
467
|
-
|
468
|
-
<li class="public ">
|
469
|
-
<span class="summary_signature">
|
470
|
-
|
471
|
-
<a href="#msg_type_hash_keys-instance_method" title="#msg_type_hash_keys (instance method)">#<strong>msg_type_hash_keys</strong>(msg_type) ⇒ Object </a>
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
</span>
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
<span class="summary_desc"><div class='inline'>
|
486
|
-
<p>Returns hash keys that are related to given message type.</p>
|
487
|
-
</div></span>
|
488
|
-
|
489
|
-
</li>
|
490
|
-
|
491
|
-
|
492
|
-
<li class="public ">
|
493
|
-
<span class="summary_signature">
|
494
|
-
|
495
|
-
<a href="#msg_type_hash_opt_keys-instance_method" title="#msg_type_hash_opt_keys (instance method)">#<strong>msg_type_hash_opt_keys</strong>(msg_type) ⇒ Object </a>
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
</span>
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
<span class="summary_desc"><div class='inline'>
|
510
|
-
<p>Returns optional hash keys that are related to given message type.</p>
|
511
|
-
</div></span>
|
512
|
-
|
513
|
-
</li>
|
514
|
-
|
515
|
-
|
516
|
-
<li class="private ">
|
517
|
-
<span class="summary_signature">
|
518
|
-
|
519
|
-
<a href="#msg_type_which_hash_keys-instance_method" title="#msg_type_which_hash_keys (instance method)">#<strong>msg_type_which_hash_keys</strong>(msg_type, optional = false) ⇒ Array<Symbol> </a>
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
</span>
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
<span class="note title private">private</span>
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
<span class="summary_desc"><div class='inline'>
|
534
|
-
<p>Helper method that is called by <span class='object_link'><a href="#msg_type_hash_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_hash_keys (method)">#msg_type_hash_keys</a></span> or
|
535
|
-
<span class='object_link'><a href="#msg_type_hash_opt_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_hash_opt_keys (method)">#msg_type_hash_opt_keys</a></span>.</p>
|
536
|
-
</div></span>
|
537
|
-
|
538
|
-
</li>
|
539
|
-
|
540
|
-
|
541
|
-
<li class="private ">
|
542
|
-
<span class="summary_signature">
|
543
|
-
|
544
|
-
<a href="#msg_types-instance_method" title="#msg_types (instance method)">#<strong>msg_types</strong> ⇒ Array<String> </a>
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
</span>
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
<span class="note title private">private</span>
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
<span class="summary_desc"><div class='inline'>
|
559
|
-
<p>Gets <code>MSG_TYPES</code> constant depending on object's end-class.</p>
|
560
|
-
</div></span>
|
561
|
-
|
562
|
-
</li>
|
563
|
-
|
564
|
-
|
565
|
-
<li class="public ">
|
566
|
-
<span class="summary_signature">
|
567
|
-
|
568
|
-
<a href="#valid_data_type-instance_method" title="#valid_data_type (instance method)">#<strong>valid_data_type</strong>(raw_data) ⇒ Boolean </a>
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
</span>
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
<span class="summary_desc"><div class='inline'>
|
583
|
-
<p>Checks whether raw data string is <code>String</code>.</p>
|
584
|
-
</div></span>
|
585
|
-
|
586
|
-
</li>
|
587
|
-
|
588
|
-
|
589
|
-
<li class="public ">
|
590
|
-
<span class="summary_signature">
|
591
|
-
|
592
|
-
<a href="#valid_hash-instance_method" title="#valid_hash (instance method)">#<strong>valid_hash</strong>(hash) ⇒ Boolean </a>
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
</span>
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
<span class="summary_desc"><div class='inline'>
|
607
|
-
<p>Validates if given hash satisfies basic conditions for all hashes being
|
608
|
-
used with messages.</p>
|
609
|
-
</div></span>
|
610
|
-
|
611
|
-
</li>
|
612
|
-
|
613
|
-
|
614
|
-
<li class="public ">
|
615
|
-
<span class="summary_signature">
|
616
|
-
|
617
|
-
<a href="#valid_hash_keys-instance_method" title="#valid_hash_keys (instance method)">#<strong>valid_hash_keys</strong>(hash) ⇒ Object </a>
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
</span>
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
<span class="summary_desc"><div class='inline'>
|
632
|
-
<p>Validates if given hash contain valid keys, depending on its message type
|
633
|
-
(according to <span class='object_link'><a href="#msg_type_which_hash_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_which_hash_keys (method)">#msg_type_which_hash_keys</a></span>).</p>
|
634
|
-
</div></span>
|
635
|
-
|
636
|
-
</li>
|
637
|
-
|
638
|
-
|
639
|
-
<li class="public ">
|
640
|
-
<span class="summary_signature">
|
641
|
-
|
642
|
-
<a href="#valid_hash_msg_type-instance_method" title="#valid_hash_msg_type (instance method)">#<strong>valid_hash_msg_type</strong>(hash) ⇒ Object </a>
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
</span>
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
<span class="summary_desc"><div class='inline'>
|
657
|
-
<p>Validates whether message type character in hash is valid.</p>
|
658
|
-
</div></span>
|
659
|
-
|
660
|
-
</li>
|
661
|
-
|
662
|
-
|
663
|
-
<li class="public ">
|
664
|
-
<span class="summary_signature">
|
665
|
-
|
666
|
-
<a href="#valid_hash_values-instance_method" title="#valid_hash_values (instance method)">#<strong>valid_hash_values</strong>(hash) ⇒ Boolean </a>
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
</span>
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
<span class="summary_desc"><div class='inline'>
|
681
|
-
<p>Validates if values of given hash satisfies basic conditions for all hashes
|
682
|
-
being used with messages.</p>
|
683
|
-
</div></span>
|
684
|
-
|
685
|
-
</li>
|
686
|
-
|
687
|
-
|
688
|
-
<li class="public ">
|
689
|
-
<span class="summary_signature">
|
690
|
-
|
691
|
-
<a href="#valid_msg-instance_method" title="#valid_msg (instance method)">#<strong>valid_msg</strong>(msg) ⇒ Object </a>
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
</span>
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
<span class="summary_desc"><div class='inline'>
|
706
|
-
<p>Validates whether whole message is valid from general point of view,
|
707
|
-
independently of parser/sserializer.</p>
|
708
|
-
</div></span>
|
709
|
-
|
710
|
-
</li>
|
711
|
-
|
712
|
-
|
713
|
-
<li class="public ">
|
714
|
-
<span class="summary_signature">
|
715
|
-
|
716
|
-
<a href="#valid_msg_msg_type-instance_method" title="#valid_msg_msg_type (instance method)">#<strong>valid_msg_msg_type</strong>(msg) ⇒ Object </a>
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
</span>
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
<span class="summary_desc"><div class='inline'>
|
731
|
-
<p>Validates whether message type character of message is valid.</p>
|
732
|
-
</div></span>
|
733
|
-
|
734
|
-
</li>
|
735
|
-
|
736
|
-
|
737
|
-
<li class="private ">
|
738
|
-
<span class="summary_signature">
|
739
|
-
|
740
|
-
<a href="#valid_msg_part_lengths-instance_method" title="#valid_msg_part_lengths (instance method)">#<strong>valid_msg_part_lengths</strong>(lengths, *args) ⇒ Boolean </a>
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
</span>
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
<span class="note title private">private</span>
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
<span class="summary_desc"><div class='inline'>
|
755
|
-
<p>Checks whether given <code>args</code> satisfy lengths specified in input
|
756
|
-
<code>lengths</code>.</p>
|
757
|
-
</div></span>
|
758
|
-
|
759
|
-
</li>
|
760
|
-
|
761
|
-
|
762
|
-
<li class="public ">
|
763
|
-
<span class="summary_signature">
|
764
|
-
|
765
|
-
<a href="#valid_msg_type-instance_method" title="#valid_msg_type (instance method)">#<strong>valid_msg_type</strong>(msg_type) ⇒ Boolean </a>
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
</span>
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
<span class="summary_desc"><div class='inline'>
|
780
|
-
<p>Validates whether message type character is valid.</p>
|
781
|
-
</div></span>
|
782
|
-
|
783
|
-
</li>
|
784
|
-
|
785
|
-
|
786
|
-
</ul>
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Messages.html" title="MaxCube::Messages (module)">MaxCube::Messages</a></span></h3>
|
799
|
-
<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>
|
800
|
-
|
801
|
-
|
802
|
-
<div id="instance_method_details" class="method_details_list">
|
803
|
-
<h2>Instance Method Details</h2>
|
804
|
-
|
805
|
-
|
806
|
-
<div class="method_details first">
|
807
|
-
<h3 class="signature first" id="check_data_type-instance_method">
|
808
|
-
|
809
|
-
#<strong>check_data_type</strong>(raw_data) ⇒ <tt>String</tt>
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
</h3><div class="docstring">
|
816
|
-
<div class="discussion">
|
817
|
-
|
818
|
-
<p>Checks whether <span class='object_link'><a href="#valid_data_type-instance_method" title="MaxCube::Messages::Handler#valid_data_type (method)">#valid_data_type</a></span> is <code>true</code>. If not, exception
|
819
|
-
is raised.</p>
|
820
|
-
|
821
|
-
|
822
|
-
</div>
|
823
|
-
</div>
|
824
|
-
<div class="tags">
|
825
|
-
|
826
|
-
<p class="tag_title">Returns:</p>
|
827
|
-
<ul class="return">
|
828
|
-
|
829
|
-
<li>
|
830
|
-
|
831
|
-
|
832
|
-
<span class='type'>(<tt>String</tt>)</span>
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
—
|
837
|
-
<div class='inline'>
|
838
|
-
<p>input raw data string.</p>
|
839
|
-
</div>
|
840
|
-
|
841
|
-
</li>
|
842
|
-
|
843
|
-
</ul>
|
844
|
-
<p class="tag_title">Raises:</p>
|
845
|
-
<ul class="raise">
|
846
|
-
|
847
|
-
<li>
|
848
|
-
|
849
|
-
|
850
|
-
<span class='type'>(<tt>TypeError</tt>)</span>
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
—
|
855
|
-
<div class='inline'>
|
856
|
-
<p>if argument is <em>not</em> valid.</p>
|
857
|
-
</div>
|
858
|
-
|
859
|
-
</li>
|
860
|
-
|
861
|
-
</ul>
|
862
|
-
|
863
|
-
</div><table class="source_code">
|
864
|
-
<tr>
|
865
|
-
<td>
|
866
|
-
<pre class="lines">
|
867
|
-
|
868
|
-
|
869
|
-
31
|
870
|
-
32
|
871
|
-
33
|
872
|
-
34</pre>
|
873
|
-
</td>
|
874
|
-
<td>
|
875
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 31</span>
|
876
|
-
|
877
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_check_data_type'>check_data_type</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_data'>raw_data</span><span class='rparen'>)</span>
|
878
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>TypeError</span> <span class='kw'>unless</span> <span class='id identifier rubyid_valid_data_type'>valid_data_type</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_data'>raw_data</span><span class='rparen'>)</span>
|
879
|
-
<span class='id identifier rubyid_raw_data'>raw_data</span>
|
880
|
-
<span class='kw'>end</span></pre>
|
881
|
-
</td>
|
882
|
-
</tr>
|
883
|
-
</table>
|
884
|
-
</div>
|
885
|
-
|
886
|
-
<div class="method_details ">
|
887
|
-
<h3 class="signature " id="check_hash-instance_method">
|
888
|
-
|
889
|
-
#<strong>check_hash</strong>(hash) ⇒ <tt>Hash</tt>
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
</h3><div class="docstring">
|
896
|
-
<div class="discussion">
|
897
|
-
|
898
|
-
<p>As <span class='object_link'><a href="#valid_hash-instance_method" title="MaxCube::Messages::Handler#valid_hash (method)">#valid_hash</a></span>, but raises exception if hash is <em>not</em> valid. Calls
|
899
|
-
<span class='object_link'><a href="#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="#check_hash_keys-instance_method" title="MaxCube::Messages::Handler#check_hash_keys (method)">#check_hash_keys</a></span> and <span class='object_link'><a href="#check_hash_values-instance_method" title="MaxCube::Messages::Handler#check_hash_values (method)">#check_hash_values</a></span>.</p>
|
900
|
-
|
901
|
-
|
902
|
-
</div>
|
903
|
-
</div>
|
904
|
-
<div class="tags">
|
905
|
-
<p class="tag_title">Parameters:</p>
|
906
|
-
<ul class="param">
|
907
|
-
|
908
|
-
<li>
|
909
|
-
|
910
|
-
<span class='name'>hash</span>
|
911
|
-
|
912
|
-
|
913
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
—
|
918
|
-
<div class='inline'>
|
919
|
-
<p>input hash.</p>
|
920
|
-
</div>
|
921
|
-
|
922
|
-
</li>
|
923
|
-
|
924
|
-
</ul>
|
925
|
-
|
926
|
-
<p class="tag_title">Returns:</p>
|
927
|
-
<ul class="return">
|
928
|
-
|
929
|
-
<li>
|
930
|
-
|
931
|
-
|
932
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
—
|
937
|
-
<div class='inline'>
|
938
|
-
<p>input hash.</p>
|
939
|
-
</div>
|
940
|
-
|
941
|
-
</li>
|
942
|
-
|
943
|
-
</ul>
|
944
|
-
|
945
|
-
</div><table class="source_code">
|
946
|
-
<tr>
|
947
|
-
<td>
|
948
|
-
<pre class="lines">
|
949
|
-
|
950
|
-
|
951
|
-
175
|
952
|
-
176
|
953
|
-
177
|
954
|
-
178
|
955
|
-
179
|
956
|
-
180</pre>
|
957
|
-
</td>
|
958
|
-
<td>
|
959
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 175</span>
|
960
|
-
|
961
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_check_hash'>check_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
962
|
-
<span class='id identifier rubyid_check_hash_msg_type'>check_hash_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
963
|
-
<span class='id identifier rubyid_check_hash_keys'>check_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
964
|
-
<span class='id identifier rubyid_check_hash_values'>check_hash_values</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
965
|
-
<span class='id identifier rubyid_hash'>hash</span>
|
966
|
-
<span class='kw'>end</span></pre>
|
967
|
-
</td>
|
968
|
-
</tr>
|
969
|
-
</table>
|
970
|
-
</div>
|
971
|
-
|
972
|
-
<div class="method_details ">
|
973
|
-
<h3 class="signature " id="check_hash_keys-instance_method">
|
974
|
-
|
975
|
-
#<strong>check_hash_keys</strong>(hash) ⇒ <tt>Hash</tt>
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
</h3><div class="docstring">
|
982
|
-
<div class="discussion">
|
983
|
-
|
984
|
-
<p>As <span class='object_link'><a href="#valid_hash_keys-instance_method" title="MaxCube::Messages::Handler#valid_hash_keys (method)">#valid_hash_keys</a></span>, but raises exception if hash is <em>not</em> valid.
|
985
|
-
Calls <span class='object_link'><a href="#maybe_check_valid_hash_keys-instance_method" title="MaxCube::Messages::Handler#maybe_check_valid_hash_keys (method)">#maybe_check_valid_hash_keys</a></span>.</p>
|
986
|
-
|
987
|
-
|
988
|
-
</div>
|
989
|
-
</div>
|
990
|
-
<div class="tags">
|
991
|
-
<p class="tag_title">Parameters:</p>
|
992
|
-
<ul class="param">
|
993
|
-
|
994
|
-
<li>
|
995
|
-
|
996
|
-
<span class='name'>hash</span>
|
997
|
-
|
998
|
-
|
999
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
—
|
1004
|
-
<div class='inline'>
|
1005
|
-
<p>input hash.</p>
|
1006
|
-
</div>
|
1007
|
-
|
1008
|
-
</li>
|
1009
|
-
|
1010
|
-
</ul>
|
1011
|
-
|
1012
|
-
<p class="tag_title">Returns:</p>
|
1013
|
-
<ul class="return">
|
1014
|
-
|
1015
|
-
<li>
|
1016
|
-
|
1017
|
-
|
1018
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
—
|
1023
|
-
<div class='inline'>
|
1024
|
-
<p>input hash.</p>
|
1025
|
-
</div>
|
1026
|
-
|
1027
|
-
</li>
|
1028
|
-
|
1029
|
-
</ul>
|
1030
|
-
|
1031
|
-
</div><table class="source_code">
|
1032
|
-
<tr>
|
1033
|
-
<td>
|
1034
|
-
<pre class="lines">
|
1035
|
-
|
1036
|
-
|
1037
|
-
130
|
1038
|
-
131
|
1039
|
-
132
|
1040
|
-
133</pre>
|
1041
|
-
</td>
|
1042
|
-
<td>
|
1043
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 130</span>
|
1044
|
-
|
1045
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_check_hash_keys'>check_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
1046
|
-
<span class='id identifier rubyid_maybe_check_valid_hash_keys'>maybe_check_valid_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1047
|
-
<span class='id identifier rubyid_hash'>hash</span>
|
1048
|
-
<span class='kw'>end</span></pre>
|
1049
|
-
</td>
|
1050
|
-
</tr>
|
1051
|
-
</table>
|
1052
|
-
</div>
|
1053
|
-
|
1054
|
-
<div class="method_details ">
|
1055
|
-
<h3 class="signature " id="check_hash_msg_type-instance_method">
|
1056
|
-
|
1057
|
-
#<strong>check_hash_msg_type</strong>(hash) ⇒ <tt>Object</tt>
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
</h3><div class="docstring">
|
1064
|
-
<div class="discussion">
|
1065
|
-
|
1066
|
-
<p>Checks whether message type character in hash is valid. Calls
|
1067
|
-
<span class='object_link'><a href="#check_msg_type-instance_method" title="MaxCube::Messages::Handler#check_msg_type (method)">#check_msg_type</a></span>. If argument is valid, it assigns the message type to
|
1068
|
-
internal variable.</p>
|
1069
|
-
|
1070
|
-
|
1071
|
-
</div>
|
1072
|
-
</div>
|
1073
|
-
<div class="tags">
|
1074
|
-
<p class="tag_title">Parameters:</p>
|
1075
|
-
<ul class="param">
|
1076
|
-
|
1077
|
-
<li>
|
1078
|
-
|
1079
|
-
<span class='name'>hash</span>
|
1080
|
-
|
1081
|
-
|
1082
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
—
|
1087
|
-
<div class='inline'>
|
1088
|
-
<p>input hash.</p>
|
1089
|
-
</div>
|
1090
|
-
|
1091
|
-
</li>
|
1092
|
-
|
1093
|
-
</ul>
|
1094
|
-
|
1095
|
-
|
1096
|
-
</div><table class="source_code">
|
1097
|
-
<tr>
|
1098
|
-
<td>
|
1099
|
-
<pre class="lines">
|
1100
|
-
|
1101
|
-
|
1102
|
-
98
|
1103
|
-
99
|
1104
|
-
100</pre>
|
1105
|
-
</td>
|
1106
|
-
<td>
|
1107
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 98</span>
|
1108
|
-
|
1109
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_check_hash_msg_type'>check_hash_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
1110
|
-
<span class='id identifier rubyid_check_msg_type'>check_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1111
|
-
<span class='kw'>end</span></pre>
|
1112
|
-
</td>
|
1113
|
-
</tr>
|
1114
|
-
</table>
|
1115
|
-
</div>
|
1116
|
-
|
1117
|
-
<div class="method_details ">
|
1118
|
-
<h3 class="signature " id="check_hash_values-instance_method">
|
1119
|
-
|
1120
|
-
#<strong>check_hash_values</strong>(hash) ⇒ <tt>Hash</tt>
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
</h3><div class="docstring">
|
1127
|
-
<div class="discussion">
|
1128
|
-
|
1129
|
-
<p>As <span class='object_link'><a href="#valid_hash_values-instance_method" title="MaxCube::Messages::Handler#valid_hash_values (method)">#valid_hash_values</a></span>, but raises exception if hash values are
|
1130
|
-
<em>not</em> valid.</p>
|
1131
|
-
|
1132
|
-
|
1133
|
-
</div>
|
1134
|
-
</div>
|
1135
|
-
<div class="tags">
|
1136
|
-
<p class="tag_title">Parameters:</p>
|
1137
|
-
<ul class="param">
|
1138
|
-
|
1139
|
-
<li>
|
1140
|
-
|
1141
|
-
<span class='name'>hash</span>
|
1142
|
-
|
1143
|
-
|
1144
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
—
|
1149
|
-
<div class='inline'>
|
1150
|
-
<p>input hash.</p>
|
1151
|
-
</div>
|
1152
|
-
|
1153
|
-
</li>
|
1154
|
-
|
1155
|
-
</ul>
|
1156
|
-
|
1157
|
-
<p class="tag_title">Returns:</p>
|
1158
|
-
<ul class="return">
|
1159
|
-
|
1160
|
-
<li>
|
1161
|
-
|
1162
|
-
|
1163
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
—
|
1168
|
-
<div class='inline'>
|
1169
|
-
<p>input hash.</p>
|
1170
|
-
</div>
|
1171
|
-
|
1172
|
-
</li>
|
1173
|
-
|
1174
|
-
</ul>
|
1175
|
-
<p class="tag_title">Raises:</p>
|
1176
|
-
<ul class="raise">
|
1177
|
-
|
1178
|
-
<li>
|
1179
|
-
|
1180
|
-
|
1181
|
-
<span class='type'>(<tt><span class='object_link'><a href="InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></tt>)</span>
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
—
|
1186
|
-
<div class='inline'>
|
1187
|
-
<p>if hash values are <em>not</em> valid.</p>
|
1188
|
-
</div>
|
1189
|
-
|
1190
|
-
</li>
|
1191
|
-
|
1192
|
-
</ul>
|
1193
|
-
|
1194
|
-
</div><table class="source_code">
|
1195
|
-
<tr>
|
1196
|
-
<td>
|
1197
|
-
<pre class="lines">
|
1198
|
-
|
1199
|
-
|
1200
|
-
149
|
1201
|
-
150
|
1202
|
-
151
|
1203
|
-
152
|
1204
|
-
153
|
1205
|
-
154
|
1206
|
-
155</pre>
|
1207
|
-
</td>
|
1208
|
-
<td>
|
1209
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 149</span>
|
1210
|
-
|
1211
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_check_hash_values'>check_hash_values</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
1212
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_hash'>hash</span> <span class='kw'>if</span> <span class='id identifier rubyid_valid_hash_values'>valid_hash_values</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
1213
|
-
<span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
|
1214
|
-
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:type</span><span class='rparen'>)</span>
|
1215
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></span>
|
1216
|
-
<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'>"</span><span class='tstring_content'>invalid hash values: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_hash'>hash</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1217
|
-
<span class='kw'>end</span></pre>
|
1218
|
-
</td>
|
1219
|
-
</tr>
|
1220
|
-
</table>
|
1221
|
-
</div>
|
1222
|
-
|
1223
|
-
<div class="method_details ">
|
1224
|
-
<h3 class="signature " id="check_msg-instance_method">
|
1225
|
-
|
1226
|
-
#<strong>check_msg</strong>(msg) ⇒ <tt>Object</tt>
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
</h3><div class="docstring">
|
1233
|
-
<div class="discussion">
|
1234
|
-
|
1235
|
-
<p>As <span class='object_link'><a href="#valid_msg-instance_method" title="MaxCube::Messages::Handler#valid_msg (method)">#valid_msg</a></span>, but raises exception if message is invalid. Currently, it
|
1236
|
-
just calls <span class='object_link'><a href="#check_msg_msg_type-instance_method" title="MaxCube::Messages::Handler#check_msg_msg_type (method)">#check_msg_msg_type</a></span>.</p>
|
1237
|
-
|
1238
|
-
|
1239
|
-
</div>
|
1240
|
-
</div>
|
1241
|
-
<div class="tags">
|
1242
|
-
<p class="tag_title">Parameters:</p>
|
1243
|
-
<ul class="param">
|
1244
|
-
|
1245
|
-
<li>
|
1246
|
-
|
1247
|
-
<span class='name'>msg</span>
|
1248
|
-
|
1249
|
-
|
1250
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
—
|
1255
|
-
<div class='inline'>
|
1256
|
-
<p>input message.</p>
|
1257
|
-
</div>
|
1258
|
-
|
1259
|
-
</li>
|
1260
|
-
|
1261
|
-
</ul>
|
1262
|
-
|
1263
|
-
|
1264
|
-
</div><table class="source_code">
|
1265
|
-
<tr>
|
1266
|
-
<td>
|
1267
|
-
<pre class="lines">
|
1268
|
-
|
1269
|
-
|
1270
|
-
83
|
1271
|
-
84
|
1272
|
-
85</pre>
|
1273
|
-
</td>
|
1274
|
-
<td>
|
1275
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 83</span>
|
1276
|
-
|
1277
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_check_msg'>check_msg</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
1278
|
-
<span class='id identifier rubyid_check_msg_msg_type'>check_msg_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
1279
|
-
<span class='kw'>end</span></pre>
|
1280
|
-
</td>
|
1281
|
-
</tr>
|
1282
|
-
</table>
|
1283
|
-
</div>
|
1284
|
-
|
1285
|
-
<div class="method_details ">
|
1286
|
-
<h3 class="signature " id="check_msg_msg_type-instance_method">
|
1287
|
-
|
1288
|
-
#<strong>check_msg_msg_type</strong>(msg) ⇒ <tt>Object</tt>
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
</h3><div class="docstring">
|
1295
|
-
<div class="discussion">
|
1296
|
-
|
1297
|
-
<p>Checks whether message type character of message is valid. Calls
|
1298
|
-
<span class='object_link'><a href="#check_msg_type-instance_method" title="MaxCube::Messages::Handler#check_msg_type (method)">#check_msg_type</a></span> and #msg_msg_type (this method depends on conrete
|
1299
|
-
end-class). If argument is valid, it assigns the message type to internal
|
1300
|
-
variable.</p>
|
1301
|
-
|
1302
|
-
|
1303
|
-
</div>
|
1304
|
-
</div>
|
1305
|
-
<div class="tags">
|
1306
|
-
<p class="tag_title">Parameters:</p>
|
1307
|
-
<ul class="param">
|
1308
|
-
|
1309
|
-
<li>
|
1310
|
-
|
1311
|
-
<span class='name'>msg</span>
|
1312
|
-
|
1313
|
-
|
1314
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
—
|
1319
|
-
<div class='inline'>
|
1320
|
-
<p>input message.</p>
|
1321
|
-
</div>
|
1322
|
-
|
1323
|
-
</li>
|
1324
|
-
|
1325
|
-
</ul>
|
1326
|
-
|
1327
|
-
|
1328
|
-
</div><table class="source_code">
|
1329
|
-
<tr>
|
1330
|
-
<td>
|
1331
|
-
<pre class="lines">
|
1332
|
-
|
1333
|
-
|
1334
|
-
68
|
1335
|
-
69
|
1336
|
-
70</pre>
|
1337
|
-
</td>
|
1338
|
-
<td>
|
1339
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 68</span>
|
1340
|
-
|
1341
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_check_msg_msg_type'>check_msg_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
1342
|
-
<span class='id identifier rubyid_check_msg_type'>check_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_msg_type'>msg_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1343
|
-
<span class='kw'>end</span></pre>
|
1344
|
-
</td>
|
1345
|
-
</tr>
|
1346
|
-
</table>
|
1347
|
-
</div>
|
1348
|
-
|
1349
|
-
<div class="method_details ">
|
1350
|
-
<h3 class="signature " id="check_msg_part_lengths-instance_method">
|
1351
|
-
|
1352
|
-
#<strong>check_msg_part_lengths</strong>(lengths, *args) ⇒ <tt>Array</tt> <span class="extras">(private)</span>
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
</h3><div class="docstring">
|
1359
|
-
<div class="discussion">
|
1360
|
-
|
1361
|
-
<p>As <span class='object_link'><a href="#valid_msg_part_lengths-instance_method" title="MaxCube::Messages::Handler#valid_msg_part_lengths (method)">#valid_msg_part_lengths</a></span>, but raises exception on failure.</p>
|
1362
|
-
|
1363
|
-
|
1364
|
-
</div>
|
1365
|
-
</div>
|
1366
|
-
<div class="tags">
|
1367
|
-
|
1368
|
-
<p class="tag_title">Returns:</p>
|
1369
|
-
<ul class="return">
|
1370
|
-
|
1371
|
-
<li>
|
1372
|
-
|
1373
|
-
|
1374
|
-
<span class='type'>(<tt>Array</tt>)</span>
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
—
|
1379
|
-
<div class='inline'>
|
1380
|
-
<p><code>args</code> if <code>lengths</code> are satisfied.</p>
|
1381
|
-
</div>
|
1382
|
-
|
1383
|
-
</li>
|
1384
|
-
|
1385
|
-
</ul>
|
1386
|
-
<p class="tag_title">Raises:</p>
|
1387
|
-
<ul class="raise">
|
1388
|
-
|
1389
|
-
<li>
|
1390
|
-
|
1391
|
-
|
1392
|
-
<span class='type'>(<tt><span class='object_link'><a href="InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></tt>)</span>
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
—
|
1397
|
-
<div class='inline'>
|
1398
|
-
<p>if <code>lengths</code> are <em>not</em> satisfied.</p>
|
1399
|
-
</div>
|
1400
|
-
|
1401
|
-
</li>
|
1402
|
-
|
1403
|
-
</ul>
|
1404
|
-
|
1405
|
-
</div><table class="source_code">
|
1406
|
-
<tr>
|
1407
|
-
<td>
|
1408
|
-
<pre class="lines">
|
1409
|
-
|
1410
|
-
|
1411
|
-
225
|
1412
|
-
226
|
1413
|
-
227
|
1414
|
-
228
|
1415
|
-
229
|
1416
|
-
230
|
1417
|
-
231</pre>
|
1418
|
-
</td>
|
1419
|
-
<td>
|
1420
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 225</span>
|
1421
|
-
|
1422
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_check_msg_part_lengths'>check_msg_part_lengths</span><span class='lparen'>(</span><span class='id identifier rubyid_lengths'>lengths</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
1423
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_args'>args</span> <span class='kw'>if</span> <span class='id identifier rubyid_valid_msg_part_lengths'>valid_msg_part_lengths</span><span class='lparen'>(</span><span class='id identifier rubyid_lengths'>lengths</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
1424
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></span>
|
1425
|
-
<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>
|
1426
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>invalid lengths of message parts </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_args'>args</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> \
|
1427
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> (lengths should be: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_lengths'>lengths</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1428
|
-
<span class='kw'>end</span></pre>
|
1429
|
-
</td>
|
1430
|
-
</tr>
|
1431
|
-
</table>
|
1432
|
-
</div>
|
1433
|
-
|
1434
|
-
<div class="method_details ">
|
1435
|
-
<h3 class="signature " id="check_msg_type-instance_method">
|
1436
|
-
|
1437
|
-
#<strong>check_msg_type</strong>(msg_type) ⇒ <tt>String</tt>
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
</h3><div class="docstring">
|
1444
|
-
<div class="discussion">
|
1445
|
-
|
1446
|
-
<p>Checks whether message type character is valid. Calls
|
1447
|
-
<span class='object_link'><a href="#maybe_check_valid_msg_type-instance_method" title="MaxCube::Messages::Handler#maybe_check_valid_msg_type (method)">#maybe_check_valid_msg_type</a></span>. If argument is valid, it assigns the message
|
1448
|
-
type to internal variable.</p>
|
1449
|
-
|
1450
|
-
|
1451
|
-
</div>
|
1452
|
-
</div>
|
1453
|
-
<div class="tags">
|
1454
|
-
<p class="tag_title">Parameters:</p>
|
1455
|
-
<ul class="param">
|
1456
|
-
|
1457
|
-
<li>
|
1458
|
-
|
1459
|
-
<span class='name'>msg_type</span>
|
1460
|
-
|
1461
|
-
|
1462
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
—
|
1467
|
-
<div class='inline'>
|
1468
|
-
<p>input message type character.</p>
|
1469
|
-
</div>
|
1470
|
-
|
1471
|
-
</li>
|
1472
|
-
|
1473
|
-
</ul>
|
1474
|
-
|
1475
|
-
<p class="tag_title">Returns:</p>
|
1476
|
-
<ul class="return">
|
1477
|
-
|
1478
|
-
<li>
|
1479
|
-
|
1480
|
-
|
1481
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
—
|
1486
|
-
<div class='inline'>
|
1487
|
-
<p>message type character assigned to internal variable.</p>
|
1488
|
-
</div>
|
1489
|
-
|
1490
|
-
</li>
|
1491
|
-
|
1492
|
-
</ul>
|
1493
|
-
<p class="tag_title">Raises:</p>
|
1494
|
-
<ul class="raise">
|
1495
|
-
|
1496
|
-
<li>
|
1497
|
-
|
1498
|
-
|
1499
|
-
<span class='type'>(<tt><span class='object_link'><a href="InvalidMessageType.html" title="MaxCube::Messages::InvalidMessageType (class)">InvalidMessageType</a></span></tt>)</span>
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
—
|
1504
|
-
<div class='inline'>
|
1505
|
-
<p>if validation fails.</p>
|
1506
|
-
</div>
|
1507
|
-
|
1508
|
-
</li>
|
1509
|
-
|
1510
|
-
</ul>
|
1511
|
-
|
1512
|
-
</div><table class="source_code">
|
1513
|
-
<tr>
|
1514
|
-
<td>
|
1515
|
-
<pre class="lines">
|
1516
|
-
|
1517
|
-
|
1518
|
-
50
|
1519
|
-
51
|
1520
|
-
52
|
1521
|
-
53</pre>
|
1522
|
-
</td>
|
1523
|
-
<td>
|
1524
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 50</span>
|
1525
|
-
|
1526
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_check_msg_type'>check_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='rparen'>)</span>
|
1527
|
-
<span class='id identifier rubyid_maybe_check_valid_msg_type'>maybe_check_valid_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1528
|
-
<span class='ivar'>@msg_type</span>
|
1529
|
-
<span class='kw'>end</span></pre>
|
1530
|
-
</td>
|
1531
|
-
</tr>
|
1532
|
-
</table>
|
1533
|
-
</div>
|
1534
|
-
|
1535
|
-
<div class="method_details ">
|
1536
|
-
<h3 class="signature " id="decode-instance_method">
|
1537
|
-
|
1538
|
-
#<strong>decode</strong>(data) ⇒ <tt>String</tt> <span class="extras">(private)</span>
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
</h3><div class="docstring">
|
1545
|
-
<div class="discussion">
|
1546
|
-
|
1547
|
-
<p>Decodes input data with only printable characters to binary data using
|
1548
|
-
Base64#decode64.</p>
|
1549
|
-
|
1550
|
-
|
1551
|
-
</div>
|
1552
|
-
</div>
|
1553
|
-
<div class="tags">
|
1554
|
-
<p class="tag_title">Parameters:</p>
|
1555
|
-
<ul class="param">
|
1556
|
-
|
1557
|
-
<li>
|
1558
|
-
|
1559
|
-
<span class='name'>data</span>
|
1560
|
-
|
1561
|
-
|
1562
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
—
|
1567
|
-
<div class='inline'>
|
1568
|
-
<p>input Base64-encoded string.</p>
|
1569
|
-
</div>
|
1570
|
-
|
1571
|
-
</li>
|
1572
|
-
|
1573
|
-
</ul>
|
1574
|
-
|
1575
|
-
<p class="tag_title">Returns:</p>
|
1576
|
-
<ul class="return">
|
1577
|
-
|
1578
|
-
<li>
|
1579
|
-
|
1580
|
-
|
1581
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
—
|
1586
|
-
<div class='inline'>
|
1587
|
-
<p>raw data string.</p>
|
1588
|
-
</div>
|
1589
|
-
|
1590
|
-
</li>
|
1591
|
-
|
1592
|
-
</ul>
|
1593
|
-
|
1594
|
-
</div><table class="source_code">
|
1595
|
-
<tr>
|
1596
|
-
<td>
|
1597
|
-
<pre class="lines">
|
1598
|
-
|
1599
|
-
|
1600
|
-
283
|
1601
|
-
284
|
1602
|
-
285</pre>
|
1603
|
-
</td>
|
1604
|
-
<td>
|
1605
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 283</span>
|
1606
|
-
|
1607
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_decode'>decode</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
1608
|
-
<span class='const'>Base64</span><span class='period'>.</span><span class='id identifier rubyid_decode64'>decode64</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
1609
|
-
<span class='kw'>end</span></pre>
|
1610
|
-
</td>
|
1611
|
-
</tr>
|
1612
|
-
</table>
|
1613
|
-
</div>
|
1614
|
-
|
1615
|
-
<div class="method_details ">
|
1616
|
-
<h3 class="signature " id="encode-instance_method">
|
1617
|
-
|
1618
|
-
#<strong>encode</strong>(data) ⇒ <tt>String</tt> <span class="extras">(private)</span>
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
</h3><div class="docstring">
|
1625
|
-
<div class="discussion">
|
1626
|
-
|
1627
|
-
<p>Encodes input binary data to only printable characters using
|
1628
|
-
Base64#strict_encode64.</p>
|
1629
|
-
|
1630
|
-
|
1631
|
-
</div>
|
1632
|
-
</div>
|
1633
|
-
<div class="tags">
|
1634
|
-
<p class="tag_title">Parameters:</p>
|
1635
|
-
<ul class="param">
|
1636
|
-
|
1637
|
-
<li>
|
1638
|
-
|
1639
|
-
<span class='name'>data</span>
|
1640
|
-
|
1641
|
-
|
1642
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
—
|
1647
|
-
<div class='inline'>
|
1648
|
-
<p>input raw data string.</p>
|
1649
|
-
</div>
|
1650
|
-
|
1651
|
-
</li>
|
1652
|
-
|
1653
|
-
</ul>
|
1654
|
-
|
1655
|
-
<p class="tag_title">Returns:</p>
|
1656
|
-
<ul class="return">
|
1657
|
-
|
1658
|
-
<li>
|
1659
|
-
|
1660
|
-
|
1661
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
—
|
1666
|
-
<div class='inline'>
|
1667
|
-
<p>Base64-encoded string.</p>
|
1668
|
-
</div>
|
1669
|
-
|
1670
|
-
</li>
|
1671
|
-
|
1672
|
-
</ul>
|
1673
|
-
|
1674
|
-
</div><table class="source_code">
|
1675
|
-
<tr>
|
1676
|
-
<td>
|
1677
|
-
<pre class="lines">
|
1678
|
-
|
1679
|
-
|
1680
|
-
275
|
1681
|
-
276
|
1682
|
-
277</pre>
|
1683
|
-
</td>
|
1684
|
-
<td>
|
1685
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 275</span>
|
1686
|
-
|
1687
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_encode'>encode</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
1688
|
-
<span class='const'>Base64</span><span class='period'>.</span><span class='id identifier rubyid_strict_encode64'>strict_encode64</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
1689
|
-
<span class='kw'>end</span></pre>
|
1690
|
-
</td>
|
1691
|
-
</tr>
|
1692
|
-
</table>
|
1693
|
-
</div>
|
1694
|
-
|
1695
|
-
<div class="method_details ">
|
1696
|
-
<h3 class="signature " id="maybe_check_valid_hash_keys-instance_method">
|
1697
|
-
|
1698
|
-
#<strong>maybe_check_valid_hash_keys</strong>(hash, check) ⇒ <tt>Boolean</tt> <span class="extras">(private)</span>
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
</h3><div class="docstring">
|
1705
|
-
<div class="discussion">
|
1706
|
-
|
1707
|
-
<p>Helper method that is called by <span class='object_link'><a href="#valid_hash_keys-instance_method" title="MaxCube::Messages::Handler#valid_hash_keys (method)">#valid_hash_keys</a></span> or <span class='object_link'><a href="#check_hash_keys-instance_method" title="MaxCube::Messages::Handler#check_hash_keys (method)">#check_hash_keys</a></span>.
|
1708
|
-
It validates/checks whether given hash contain all mandatory keys
|
1709
|
-
(<span class='object_link'><a href="#msg_type_hash_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_hash_keys (method)">#msg_type_hash_keys</a></span>) and not other than optional keys
|
1710
|
-
(<span class='object_link'><a href="#msg_type_hash_opt_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_hash_opt_keys (method)">#msg_type_hash_opt_keys</a></span>).</p>
|
1711
|
-
|
1712
|
-
|
1713
|
-
</div>
|
1714
|
-
</div>
|
1715
|
-
<div class="tags">
|
1716
|
-
<p class="tag_title">Parameters:</p>
|
1717
|
-
<ul class="param">
|
1718
|
-
|
1719
|
-
<li>
|
1720
|
-
|
1721
|
-
<span class='name'>hash</span>
|
1722
|
-
|
1723
|
-
|
1724
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
—
|
1729
|
-
<div class='inline'>
|
1730
|
-
<p>input hash.</p>
|
1731
|
-
</div>
|
1732
|
-
|
1733
|
-
</li>
|
1734
|
-
|
1735
|
-
<li>
|
1736
|
-
|
1737
|
-
<span class='name'>check</span>
|
1738
|
-
|
1739
|
-
|
1740
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
—
|
1745
|
-
<div class='inline'>
|
1746
|
-
<p>whether to check (raise exception on failure).</p>
|
1747
|
-
</div>
|
1748
|
-
|
1749
|
-
</li>
|
1750
|
-
|
1751
|
-
</ul>
|
1752
|
-
|
1753
|
-
<p class="tag_title">Returns:</p>
|
1754
|
-
<ul class="return">
|
1755
|
-
|
1756
|
-
<li>
|
1757
|
-
|
1758
|
-
|
1759
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
—
|
1764
|
-
<div class='inline'>
|
1765
|
-
<p><code>true</code> or <code>false</code> for valid/invalid hash keys if
|
1766
|
-
<code>check</code> is <code>false</code>.</p>
|
1767
|
-
</div>
|
1768
|
-
|
1769
|
-
</li>
|
1770
|
-
|
1771
|
-
</ul>
|
1772
|
-
<p class="tag_title">Raises:</p>
|
1773
|
-
<ul class="raise">
|
1774
|
-
|
1775
|
-
<li>
|
1776
|
-
|
1777
|
-
|
1778
|
-
<span class='type'>(<tt><span class='object_link'><a href="InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></tt>)</span>
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
—
|
1783
|
-
<div class='inline'>
|
1784
|
-
<p>if <code>check</code> is <code>true</code> and hash keys are invalid.</p>
|
1785
|
-
</div>
|
1786
|
-
|
1787
|
-
</li>
|
1788
|
-
|
1789
|
-
</ul>
|
1790
|
-
|
1791
|
-
</div><table class="source_code">
|
1792
|
-
<tr>
|
1793
|
-
<td>
|
1794
|
-
<pre class="lines">
|
1795
|
-
|
1796
|
-
|
1797
|
-
258
|
1798
|
-
259
|
1799
|
-
260
|
1800
|
-
261
|
1801
|
-
262
|
1802
|
-
263
|
1803
|
-
264
|
1804
|
-
265
|
1805
|
-
266
|
1806
|
-
267
|
1807
|
-
268
|
1808
|
-
269</pre>
|
1809
|
-
</td>
|
1810
|
-
<td>
|
1811
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 258</span>
|
1812
|
-
|
1813
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_maybe_check_valid_hash_keys'>maybe_check_valid_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='id identifier rubyid_check'>check</span><span class='rparen'>)</span>
|
1814
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='id identifier rubyid_msg_type_hash_keys'>msg_type_hash_keys</span><span class='lparen'>(</span><span class='ivar'>@msg_type</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
|
1815
|
-
<span class='id identifier rubyid_opt_keys'>opt_keys</span> <span class='op'>=</span> <span class='id identifier rubyid_msg_type_hash_opt_keys'>msg_type_hash_opt_keys</span><span class='lparen'>(</span><span class='ivar'>@msg_type</span><span class='rparen'>)</span>
|
1816
|
-
|
1817
|
-
<span class='id identifier rubyid_hash_keys'>hash_keys</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span> <span class='op'>-</span> <span class='id identifier rubyid_opt_keys'>opt_keys</span> <span class='op'>-</span> <span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span>
|
1818
|
-
|
1819
|
-
<span class='id identifier rubyid_valid'>valid</span> <span class='op'>=</span> <span class='id identifier rubyid_hash_keys'>hash_keys</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span> <span class='op'>==</span> <span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span>
|
1820
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_valid'>valid</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_check'>check</span> <span class='op'>||</span> <span class='id identifier rubyid_valid'>valid</span>
|
1821
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="InvalidMessageBody.html" title="MaxCube::Messages::InvalidMessageBody (class)">InvalidMessageBody</a></span></span>
|
1822
|
-
<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'>"</span><span class='tstring_content'>invalid hash keys: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_hash_keys'>hash_keys</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span> \
|
1823
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>(should be: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_keys'>keys</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1824
|
-
<span class='kw'>end</span></pre>
|
1825
|
-
</td>
|
1826
|
-
</tr>
|
1827
|
-
</table>
|
1828
|
-
</div>
|
1829
|
-
|
1830
|
-
<div class="method_details ">
|
1831
|
-
<h3 class="signature " id="maybe_check_valid_msg_type-instance_method">
|
1832
|
-
|
1833
|
-
#<strong>maybe_check_valid_msg_type</strong>(msg_type, check) ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
</h3><div class="docstring">
|
1840
|
-
<div class="discussion">
|
1841
|
-
|
1842
|
-
<p>Helper method that is called by <span class='object_link'><a href="#valid_msg_type-instance_method" title="MaxCube::Messages::Handler#valid_msg_type (method)">#valid_msg_type</a></span> or <span class='object_link'><a href="#check_msg_type-instance_method" title="MaxCube::Messages::Handler#check_msg_type (method)">#check_msg_type</a></span>. It
|
1843
|
-
provides validation or check depending on input flag. If argument is valid,
|
1844
|
-
it assigns the message type to internal variable.</p>
|
1845
|
-
|
1846
|
-
|
1847
|
-
</div>
|
1848
|
-
</div>
|
1849
|
-
<div class="tags">
|
1850
|
-
<p class="tag_title">Parameters:</p>
|
1851
|
-
<ul class="param">
|
1852
|
-
|
1853
|
-
<li>
|
1854
|
-
|
1855
|
-
<span class='name'>msg_type</span>
|
1856
|
-
|
1857
|
-
|
1858
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
—
|
1863
|
-
<div class='inline'>
|
1864
|
-
<p>input message type character.</p>
|
1865
|
-
</div>
|
1866
|
-
|
1867
|
-
</li>
|
1868
|
-
|
1869
|
-
<li>
|
1870
|
-
|
1871
|
-
<span class='name'>check</span>
|
1872
|
-
|
1873
|
-
|
1874
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
—
|
1879
|
-
<div class='inline'>
|
1880
|
-
<p>whether to check (raise exception on failure).</p>
|
1881
|
-
</div>
|
1882
|
-
|
1883
|
-
</li>
|
1884
|
-
|
1885
|
-
</ul>
|
1886
|
-
|
1887
|
-
<p class="tag_title">Raises:</p>
|
1888
|
-
<ul class="raise">
|
1889
|
-
|
1890
|
-
<li>
|
1891
|
-
|
1892
|
-
|
1893
|
-
<span class='type'>(<tt><span class='object_link'><a href="InvalidMessageType.html" title="MaxCube::Messages::InvalidMessageType (class)">InvalidMessageType</a></span></tt>)</span>
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
</li>
|
1898
|
-
|
1899
|
-
</ul>
|
1900
|
-
|
1901
|
-
</div><table class="source_code">
|
1902
|
-
<tr>
|
1903
|
-
<td>
|
1904
|
-
<pre class="lines">
|
1905
|
-
|
1906
|
-
|
1907
|
-
196
|
1908
|
-
197
|
1909
|
-
198
|
1910
|
-
199
|
1911
|
-
200
|
1912
|
-
201
|
1913
|
-
202</pre>
|
1914
|
-
</td>
|
1915
|
-
<td>
|
1916
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 196</span>
|
1917
|
-
|
1918
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_maybe_check_valid_msg_type'>maybe_check_valid_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='comma'>,</span> <span class='id identifier rubyid_check'>check</span><span class='rparen'>)</span>
|
1919
|
-
<span class='id identifier rubyid_valid'>valid</span> <span class='op'>=</span> <span class='id identifier rubyid_msg_type'>msg_type</span><span class='op'>&.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>&&</span>
|
1920
|
-
<span class='id identifier rubyid_msg_types'>msg_types</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='rparen'>)</span>
|
1921
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_valid'>valid</span> <span class='op'>?</span> <span class='id identifier rubyid_msg_type'>msg_type</span> <span class='op'>:</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_check'>check</span>
|
1922
|
-
<span class='ivar'>@msg_type</span> <span class='op'>=</span> <span class='id identifier rubyid_msg_type'>msg_type</span>
|
1923
|
-
<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><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="InvalidMessageType.html#initialize-instance_method" title="MaxCube::Messages::InvalidMessageType#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='ivar'>@msg_type</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_valid'>valid</span>
|
1924
|
-
<span class='kw'>end</span></pre>
|
1925
|
-
</td>
|
1926
|
-
</tr>
|
1927
|
-
</table>
|
1928
|
-
</div>
|
1929
|
-
|
1930
|
-
<div class="method_details ">
|
1931
|
-
<h3 class="signature " id="msg_type_hash_keys-instance_method">
|
1932
|
-
|
1933
|
-
#<strong>msg_type_hash_keys</strong>(msg_type) ⇒ <tt>Object</tt>
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
</h3><div class="docstring">
|
1940
|
-
<div class="discussion">
|
1941
|
-
|
1942
|
-
<p>Returns hash keys that are related to given message type. Each hash with a
|
1943
|
-
message type should contain these keys. Calls <span class='object_link'><a href="#msg_type_which_hash_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_which_hash_keys (method)">#msg_type_which_hash_keys</a></span>.</p>
|
1944
|
-
|
1945
|
-
|
1946
|
-
</div>
|
1947
|
-
</div>
|
1948
|
-
<div class="tags">
|
1949
|
-
<p class="tag_title">Parameters:</p>
|
1950
|
-
<ul class="param">
|
1951
|
-
|
1952
|
-
<li>
|
1953
|
-
|
1954
|
-
<span class='name'>msg_type</span>
|
1955
|
-
|
1956
|
-
|
1957
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
—
|
1962
|
-
<div class='inline'>
|
1963
|
-
<p>message type that is being parsed/serialized.</p>
|
1964
|
-
</div>
|
1965
|
-
|
1966
|
-
</li>
|
1967
|
-
|
1968
|
-
</ul>
|
1969
|
-
|
1970
|
-
|
1971
|
-
</div><table class="source_code">
|
1972
|
-
<tr>
|
1973
|
-
<td>
|
1974
|
-
<pre class="lines">
|
1975
|
-
|
1976
|
-
|
1977
|
-
106
|
1978
|
-
107
|
1979
|
-
108</pre>
|
1980
|
-
</td>
|
1981
|
-
<td>
|
1982
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 106</span>
|
1983
|
-
|
1984
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_msg_type_hash_keys'>msg_type_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='rparen'>)</span>
|
1985
|
-
<span class='id identifier rubyid_msg_type_which_hash_keys'>msg_type_which_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
1986
|
-
<span class='kw'>end</span></pre>
|
1987
|
-
</td>
|
1988
|
-
</tr>
|
1989
|
-
</table>
|
1990
|
-
</div>
|
1991
|
-
|
1992
|
-
<div class="method_details ">
|
1993
|
-
<h3 class="signature " id="msg_type_hash_opt_keys-instance_method">
|
1994
|
-
|
1995
|
-
#<strong>msg_type_hash_opt_keys</strong>(msg_type) ⇒ <tt>Object</tt>
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
</h3><div class="docstring">
|
2002
|
-
<div class="discussion">
|
2003
|
-
|
2004
|
-
<p>Returns optional hash keys that are related to given message type. Calls
|
2005
|
-
<span class='object_link'><a href="#msg_type_which_hash_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_which_hash_keys (method)">#msg_type_which_hash_keys</a></span>.</p>
|
2006
|
-
|
2007
|
-
|
2008
|
-
</div>
|
2009
|
-
</div>
|
2010
|
-
<div class="tags">
|
2011
|
-
<p class="tag_title">Parameters:</p>
|
2012
|
-
<ul class="param">
|
2013
|
-
|
2014
|
-
<li>
|
2015
|
-
|
2016
|
-
<span class='name'>msg_type</span>
|
2017
|
-
|
2018
|
-
|
2019
|
-
<span class='type'>(<tt>String</tt>)</span>
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
—
|
2024
|
-
<div class='inline'>
|
2025
|
-
<p>message type that is being parsed/serialized.</p>
|
2026
|
-
</div>
|
2027
|
-
|
2028
|
-
</li>
|
2029
|
-
|
2030
|
-
</ul>
|
2031
|
-
|
2032
|
-
|
2033
|
-
</div><table class="source_code">
|
2034
|
-
<tr>
|
2035
|
-
<td>
|
2036
|
-
<pre class="lines">
|
2037
|
-
|
2038
|
-
|
2039
|
-
113
|
2040
|
-
114
|
2041
|
-
115</pre>
|
2042
|
-
</td>
|
2043
|
-
<td>
|
2044
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 113</span>
|
2045
|
-
|
2046
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_msg_type_hash_opt_keys'>msg_type_hash_opt_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='rparen'>)</span>
|
2047
|
-
<span class='id identifier rubyid_msg_type_which_hash_keys'>msg_type_which_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
2048
|
-
<span class='kw'>end</span></pre>
|
2049
|
-
</td>
|
2050
|
-
</tr>
|
2051
|
-
</table>
|
2052
|
-
</div>
|
2053
|
-
|
2054
|
-
<div class="method_details ">
|
2055
|
-
<h3 class="signature " id="msg_type_which_hash_keys-instance_method">
|
2056
|
-
|
2057
|
-
#<strong>msg_type_which_hash_keys</strong>(msg_type, optional = false) ⇒ <tt>Array<Symbol></tt> <span class="extras">(private)</span>
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
</h3><div class="docstring">
|
2064
|
-
<div class="discussion">
|
2065
|
-
|
2066
|
-
<p>Helper method that is called by <span class='object_link'><a href="#msg_type_hash_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_hash_keys (method)">#msg_type_hash_keys</a></span> or
|
2067
|
-
<span class='object_link'><a href="#msg_type_hash_opt_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_hash_opt_keys (method)">#msg_type_hash_opt_keys</a></span>. It accesses <code>KEYS</code> or
|
2068
|
-
<code>OPT_KEYS</code> (depending on input flag) from object's concrete
|
2069
|
-
end-class.</p>
|
2070
|
-
|
2071
|
-
|
2072
|
-
</div>
|
2073
|
-
</div>
|
2074
|
-
<div class="tags">
|
2075
|
-
<p class="tag_title">Parameters:</p>
|
2076
|
-
<ul class="param">
|
2077
|
-
|
2078
|
-
<li>
|
2079
|
-
|
2080
|
-
<span class='name'>msg_type</span>
|
2081
|
-
|
2082
|
-
|
2083
|
-
<span class='type'>(<tt>String</tt>)</span>
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
—
|
2088
|
-
<div class='inline'>
|
2089
|
-
<p>message type that is being parsed/serialized.</p>
|
2090
|
-
</div>
|
2091
|
-
|
2092
|
-
</li>
|
2093
|
-
|
2094
|
-
<li>
|
2095
|
-
|
2096
|
-
<span class='name'>optional</span>
|
2097
|
-
|
2098
|
-
|
2099
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
2100
|
-
|
2101
|
-
|
2102
|
-
<em class="default">(defaults to: <tt>false</tt>)</em>
|
2103
|
-
|
2104
|
-
|
2105
|
-
—
|
2106
|
-
<div class='inline'>
|
2107
|
-
<p>whether to return optional or mandatory keys.</p>
|
2108
|
-
</div>
|
2109
|
-
|
2110
|
-
</li>
|
2111
|
-
|
2112
|
-
</ul>
|
2113
|
-
|
2114
|
-
<p class="tag_title">Returns:</p>
|
2115
|
-
<ul class="return">
|
2116
|
-
|
2117
|
-
<li>
|
2118
|
-
|
2119
|
-
|
2120
|
-
<span class='type'>(<tt>Array<Symbol></tt>)</span>
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2124
|
-
—
|
2125
|
-
<div class='inline'>
|
2126
|
-
<p>mandatory or optional hash keys, depending on <code>optional</code>,
|
2127
|
-
related to message type. If constant is not found, empty array is returned.</p>
|
2128
|
-
</div>
|
2129
|
-
|
2130
|
-
</li>
|
2131
|
-
|
2132
|
-
</ul>
|
2133
|
-
|
2134
|
-
</div><table class="source_code">
|
2135
|
-
<tr>
|
2136
|
-
<td>
|
2137
|
-
<pre class="lines">
|
2138
|
-
|
2139
|
-
|
2140
|
-
242
|
2141
|
-
243
|
2142
|
-
244
|
2143
|
-
245</pre>
|
2144
|
-
</td>
|
2145
|
-
<td>
|
2146
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 242</span>
|
2147
|
-
|
2148
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_msg_type_which_hash_keys'>msg_type_which_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='comma'>,</span> <span class='id identifier rubyid_optional'>optional</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
2149
|
-
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Message</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='embexpr_end'>}</span><span class='tstring_content'>::</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id identifier rubyid_optional'>optional</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>OPT_KEYS</span><span class='tstring_end'>'</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>KEYS</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2150
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_const_defined?'>const_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
2151
|
-
<span class='kw'>end</span></pre>
|
2152
|
-
</td>
|
2153
|
-
</tr>
|
2154
|
-
</table>
|
2155
|
-
</div>
|
2156
|
-
|
2157
|
-
<div class="method_details ">
|
2158
|
-
<h3 class="signature " id="msg_types-instance_method">
|
2159
|
-
|
2160
|
-
#<strong>msg_types</strong> ⇒ <tt>Array<String></tt> <span class="extras">(private)</span>
|
2161
|
-
|
2162
|
-
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2166
|
-
</h3><div class="docstring">
|
2167
|
-
<div class="discussion">
|
2168
|
-
|
2169
|
-
<p>Gets <code>MSG_TYPES</code> constant depending on object's end-class.</p>
|
2170
|
-
|
2171
|
-
|
2172
|
-
</div>
|
2173
|
-
</div>
|
2174
|
-
<div class="tags">
|
2175
|
-
|
2176
|
-
<p class="tag_title">Returns:</p>
|
2177
|
-
<ul class="return">
|
2178
|
-
|
2179
|
-
<li>
|
2180
|
-
|
2181
|
-
|
2182
|
-
<span class='type'>(<tt>Array<String></tt>)</span>
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
—
|
2187
|
-
<div class='inline'>
|
2188
|
-
<p><code>MSG_TYPES</code> constant depending on object's end-class.</p>
|
2189
|
-
</div>
|
2190
|
-
|
2191
|
-
</li>
|
2192
|
-
|
2193
|
-
</ul>
|
2194
|
-
|
2195
|
-
</div><table class="source_code">
|
2196
|
-
<tr>
|
2197
|
-
<td>
|
2198
|
-
<pre class="lines">
|
2199
|
-
|
2200
|
-
|
2201
|
-
187
|
2202
|
-
188
|
2203
|
-
189</pre>
|
2204
|
-
</td>
|
2205
|
-
<td>
|
2206
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 187</span>
|
2207
|
-
|
2208
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_msg_types'>msg_types</span>
|
2209
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>MSG_TYPES</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2210
|
-
<span class='kw'>end</span></pre>
|
2211
|
-
</td>
|
2212
|
-
</tr>
|
2213
|
-
</table>
|
2214
|
-
</div>
|
2215
|
-
|
2216
|
-
<div class="method_details ">
|
2217
|
-
<h3 class="signature " id="valid_data_type-instance_method">
|
2218
|
-
|
2219
|
-
#<strong>valid_data_type</strong>(raw_data) ⇒ <tt>Boolean</tt>
|
2220
|
-
|
2221
|
-
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
</h3><div class="docstring">
|
2226
|
-
<div class="discussion">
|
2227
|
-
|
2228
|
-
<p>Checks whether raw data string is <code>String</code>.</p>
|
2229
|
-
|
2230
|
-
|
2231
|
-
</div>
|
2232
|
-
</div>
|
2233
|
-
<div class="tags">
|
2234
|
-
<p class="tag_title">Parameters:</p>
|
2235
|
-
<ul class="param">
|
2236
|
-
|
2237
|
-
<li>
|
2238
|
-
|
2239
|
-
<span class='name'>raw_data</span>
|
2240
|
-
|
2241
|
-
|
2242
|
-
<span class='type'></span>
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
—
|
2247
|
-
<div class='inline'>
|
2248
|
-
<p>input raw data string.</p>
|
2249
|
-
</div>
|
2250
|
-
|
2251
|
-
</li>
|
2252
|
-
|
2253
|
-
</ul>
|
2254
|
-
|
2255
|
-
<p class="tag_title">Returns:</p>
|
2256
|
-
<ul class="return">
|
2257
|
-
|
2258
|
-
<li>
|
2259
|
-
|
2260
|
-
|
2261
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
—
|
2266
|
-
<div class='inline'>
|
2267
|
-
<p><code>true</code> if argument is <code>String</code>, <code>false</code>
|
2268
|
-
otherwise.</p>
|
2269
|
-
</div>
|
2270
|
-
|
2271
|
-
</li>
|
2272
|
-
|
2273
|
-
</ul>
|
2274
|
-
|
2275
|
-
</div><table class="source_code">
|
2276
|
-
<tr>
|
2277
|
-
<td>
|
2278
|
-
<pre class="lines">
|
2279
|
-
|
2280
|
-
|
2281
|
-
23
|
2282
|
-
24
|
2283
|
-
25</pre>
|
2284
|
-
</td>
|
2285
|
-
<td>
|
2286
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 23</span>
|
2287
|
-
|
2288
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_valid_data_type'>valid_data_type</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_data'>raw_data</span><span class='rparen'>)</span>
|
2289
|
-
<span class='id identifier rubyid_raw_data'>raw_data</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>
|
2290
|
-
<span class='kw'>end</span></pre>
|
2291
|
-
</td>
|
2292
|
-
</tr>
|
2293
|
-
</table>
|
2294
|
-
</div>
|
2295
|
-
|
2296
|
-
<div class="method_details ">
|
2297
|
-
<h3 class="signature " id="valid_hash-instance_method">
|
2298
|
-
|
2299
|
-
#<strong>valid_hash</strong>(hash) ⇒ <tt>Boolean</tt>
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
</h3><div class="docstring">
|
2306
|
-
<div class="discussion">
|
2307
|
-
|
2308
|
-
<p>Validates if given hash satisfies basic conditions for all hashes being
|
2309
|
-
used with messages. Calls <span class='object_link'><a href="#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="#valid_hash_keys-instance_method" title="MaxCube::Messages::Handler#valid_hash_keys (method)">#valid_hash_keys</a></span> and
|
2310
|
-
<span class='object_link'><a href="#valid_hash_values-instance_method" title="MaxCube::Messages::Handler#valid_hash_values (method)">#valid_hash_values</a></span>.</p>
|
2311
|
-
|
2312
|
-
|
2313
|
-
</div>
|
2314
|
-
</div>
|
2315
|
-
<div class="tags">
|
2316
|
-
<p class="tag_title">Parameters:</p>
|
2317
|
-
<ul class="param">
|
2318
|
-
|
2319
|
-
<li>
|
2320
|
-
|
2321
|
-
<span class='name'>hash</span>
|
2322
|
-
|
2323
|
-
|
2324
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
—
|
2329
|
-
<div class='inline'>
|
2330
|
-
<p>input hash.</p>
|
2331
|
-
</div>
|
2332
|
-
|
2333
|
-
</li>
|
2334
|
-
|
2335
|
-
</ul>
|
2336
|
-
|
2337
|
-
<p class="tag_title">Returns:</p>
|
2338
|
-
<ul class="return">
|
2339
|
-
|
2340
|
-
<li>
|
2341
|
-
|
2342
|
-
|
2343
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
—
|
2348
|
-
<div class='inline'>
|
2349
|
-
<p><code>true</code> if hash is valid (from general point of view).</p>
|
2350
|
-
</div>
|
2351
|
-
|
2352
|
-
</li>
|
2353
|
-
|
2354
|
-
</ul>
|
2355
|
-
|
2356
|
-
</div><table class="source_code">
|
2357
|
-
<tr>
|
2358
|
-
<td>
|
2359
|
-
<pre class="lines">
|
2360
|
-
|
2361
|
-
|
2362
|
-
164
|
2363
|
-
165
|
2364
|
-
166
|
2365
|
-
167
|
2366
|
-
168</pre>
|
2367
|
-
</td>
|
2368
|
-
<td>
|
2369
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 164</span>
|
2370
|
-
|
2371
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_valid_hash'>valid_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
2372
|
-
<span class='id identifier rubyid_valid_hash_msg_type'>valid_hash_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span> <span class='op'>&&</span>
|
2373
|
-
<span class='id identifier rubyid_valid_hash_keys'>valid_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span> <span class='op'>&&</span>
|
2374
|
-
<span class='id identifier rubyid_valid_hash_values'>valid_hash_values</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
2375
|
-
<span class='kw'>end</span></pre>
|
2376
|
-
</td>
|
2377
|
-
</tr>
|
2378
|
-
</table>
|
2379
|
-
</div>
|
2380
|
-
|
2381
|
-
<div class="method_details ">
|
2382
|
-
<h3 class="signature " id="valid_hash_keys-instance_method">
|
2383
|
-
|
2384
|
-
#<strong>valid_hash_keys</strong>(hash) ⇒ <tt>Object</tt>
|
2385
|
-
|
2386
|
-
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2390
|
-
</h3><div class="docstring">
|
2391
|
-
<div class="discussion">
|
2392
|
-
|
2393
|
-
<p>Validates if given hash contain valid keys, depending on its message type
|
2394
|
-
(according to <span class='object_link'><a href="#msg_type_which_hash_keys-instance_method" title="MaxCube::Messages::Handler#msg_type_which_hash_keys (method)">#msg_type_which_hash_keys</a></span>). Calls
|
2395
|
-
<span class='object_link'><a href="#maybe_check_valid_hash_keys-instance_method" title="MaxCube::Messages::Handler#maybe_check_valid_hash_keys (method)">#maybe_check_valid_hash_keys</a></span>.</p>
|
2396
|
-
|
2397
|
-
|
2398
|
-
</div>
|
2399
|
-
</div>
|
2400
|
-
<div class="tags">
|
2401
|
-
<p class="tag_title">Parameters:</p>
|
2402
|
-
<ul class="param">
|
2403
|
-
|
2404
|
-
<li>
|
2405
|
-
|
2406
|
-
<span class='name'>hash</span>
|
2407
|
-
|
2408
|
-
|
2409
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2413
|
-
—
|
2414
|
-
<div class='inline'>
|
2415
|
-
<p>input hash.</p>
|
2416
|
-
</div>
|
2417
|
-
|
2418
|
-
</li>
|
2419
|
-
|
2420
|
-
</ul>
|
2421
|
-
|
2422
|
-
|
2423
|
-
</div><table class="source_code">
|
2424
|
-
<tr>
|
2425
|
-
<td>
|
2426
|
-
<pre class="lines">
|
2427
|
-
|
2428
|
-
|
2429
|
-
122
|
2430
|
-
123
|
2431
|
-
124</pre>
|
2432
|
-
</td>
|
2433
|
-
<td>
|
2434
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 122</span>
|
2435
|
-
|
2436
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_valid_hash_keys'>valid_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
2437
|
-
<span class='id identifier rubyid_maybe_check_valid_hash_keys'>maybe_check_valid_hash_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
2438
|
-
<span class='kw'>end</span></pre>
|
2439
|
-
</td>
|
2440
|
-
</tr>
|
2441
|
-
</table>
|
2442
|
-
</div>
|
2443
|
-
|
2444
|
-
<div class="method_details ">
|
2445
|
-
<h3 class="signature " id="valid_hash_msg_type-instance_method">
|
2446
|
-
|
2447
|
-
#<strong>valid_hash_msg_type</strong>(hash) ⇒ <tt>Object</tt>
|
2448
|
-
|
2449
|
-
|
2450
|
-
|
2451
|
-
|
2452
|
-
|
2453
|
-
</h3><div class="docstring">
|
2454
|
-
<div class="discussion">
|
2455
|
-
|
2456
|
-
<p>Validates whether message type character in hash is valid. Calls
|
2457
|
-
<span class='object_link'><a href="#valid_msg_type-instance_method" title="MaxCube::Messages::Handler#valid_msg_type (method)">#valid_msg_type</a></span>.</p>
|
2458
|
-
|
2459
|
-
|
2460
|
-
</div>
|
2461
|
-
</div>
|
2462
|
-
<div class="tags">
|
2463
|
-
<p class="tag_title">Parameters:</p>
|
2464
|
-
<ul class="param">
|
2465
|
-
|
2466
|
-
<li>
|
2467
|
-
|
2468
|
-
<span class='name'>hash</span>
|
2469
|
-
|
2470
|
-
|
2471
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
2472
|
-
|
2473
|
-
|
2474
|
-
|
2475
|
-
—
|
2476
|
-
<div class='inline'>
|
2477
|
-
<p>input hash.</p>
|
2478
|
-
</div>
|
2479
|
-
|
2480
|
-
</li>
|
2481
|
-
|
2482
|
-
</ul>
|
2483
|
-
|
2484
|
-
|
2485
|
-
</div><table class="source_code">
|
2486
|
-
<tr>
|
2487
|
-
<td>
|
2488
|
-
<pre class="lines">
|
2489
|
-
|
2490
|
-
|
2491
|
-
90
|
2492
|
-
91
|
2493
|
-
92</pre>
|
2494
|
-
</td>
|
2495
|
-
<td>
|
2496
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 90</span>
|
2497
|
-
|
2498
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_valid_hash_msg_type'>valid_hash_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
2499
|
-
<span class='id identifier rubyid_valid_msg_type'>valid_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
2500
|
-
<span class='kw'>end</span></pre>
|
2501
|
-
</td>
|
2502
|
-
</tr>
|
2503
|
-
</table>
|
2504
|
-
</div>
|
2505
|
-
|
2506
|
-
<div class="method_details ">
|
2507
|
-
<h3 class="signature " id="valid_hash_values-instance_method">
|
2508
|
-
|
2509
|
-
#<strong>valid_hash_values</strong>(hash) ⇒ <tt>Boolean</tt>
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
</h3><div class="docstring">
|
2516
|
-
<div class="discussion">
|
2517
|
-
|
2518
|
-
<p>Validates if values of given hash satisfies basic conditions for all hashes
|
2519
|
-
being used with messages.</p>
|
2520
|
-
|
2521
|
-
|
2522
|
-
</div>
|
2523
|
-
</div>
|
2524
|
-
<div class="tags">
|
2525
|
-
<p class="tag_title">Parameters:</p>
|
2526
|
-
<ul class="param">
|
2527
|
-
|
2528
|
-
<li>
|
2529
|
-
|
2530
|
-
<span class='name'>hash</span>
|
2531
|
-
|
2532
|
-
|
2533
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
—
|
2538
|
-
<div class='inline'>
|
2539
|
-
<p>input hash.</p>
|
2540
|
-
</div>
|
2541
|
-
|
2542
|
-
</li>
|
2543
|
-
|
2544
|
-
</ul>
|
2545
|
-
|
2546
|
-
<p class="tag_title">Returns:</p>
|
2547
|
-
<ul class="return">
|
2548
|
-
|
2549
|
-
<li>
|
2550
|
-
|
2551
|
-
|
2552
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
—
|
2557
|
-
<div class='inline'>
|
2558
|
-
<p><code>true</code> if hash values are valid (from general point of view).</p>
|
2559
|
-
</div>
|
2560
|
-
|
2561
|
-
</li>
|
2562
|
-
|
2563
|
-
</ul>
|
2564
|
-
|
2565
|
-
</div><table class="source_code">
|
2566
|
-
<tr>
|
2567
|
-
<td>
|
2568
|
-
<pre class="lines">
|
2569
|
-
|
2570
|
-
|
2571
|
-
140
|
2572
|
-
141
|
2573
|
-
142</pre>
|
2574
|
-
</td>
|
2575
|
-
<td>
|
2576
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 140</span>
|
2577
|
-
|
2578
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_valid_hash_values'>valid_hash_values</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
2579
|
-
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_none?'>none?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='rbrace'>}</span>
|
2580
|
-
<span class='kw'>end</span></pre>
|
2581
|
-
</td>
|
2582
|
-
</tr>
|
2583
|
-
</table>
|
2584
|
-
</div>
|
2585
|
-
|
2586
|
-
<div class="method_details ">
|
2587
|
-
<h3 class="signature " id="valid_msg-instance_method">
|
2588
|
-
|
2589
|
-
#<strong>valid_msg</strong>(msg) ⇒ <tt>Object</tt>
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
</h3><div class="docstring">
|
2596
|
-
<div class="discussion">
|
2597
|
-
|
2598
|
-
<p>Validates whether whole message is valid from general point of view,
|
2599
|
-
independently of parser/sserializer. Currently, it just calls
|
2600
|
-
<span class='object_link'><a href="#valid_msg_msg_type-instance_method" title="MaxCube::Messages::Handler#valid_msg_msg_type (method)">#valid_msg_msg_type</a></span>.</p>
|
2601
|
-
|
2602
|
-
|
2603
|
-
</div>
|
2604
|
-
</div>
|
2605
|
-
<div class="tags">
|
2606
|
-
<p class="tag_title">Parameters:</p>
|
2607
|
-
<ul class="param">
|
2608
|
-
|
2609
|
-
<li>
|
2610
|
-
|
2611
|
-
<span class='name'>msg</span>
|
2612
|
-
|
2613
|
-
|
2614
|
-
<span class='type'>(<tt>String</tt>)</span>
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
—
|
2619
|
-
<div class='inline'>
|
2620
|
-
<p>input message.</p>
|
2621
|
-
</div>
|
2622
|
-
|
2623
|
-
</li>
|
2624
|
-
|
2625
|
-
</ul>
|
2626
|
-
|
2627
|
-
|
2628
|
-
</div><table class="source_code">
|
2629
|
-
<tr>
|
2630
|
-
<td>
|
2631
|
-
<pre class="lines">
|
2632
|
-
|
2633
|
-
|
2634
|
-
76
|
2635
|
-
77
|
2636
|
-
78</pre>
|
2637
|
-
</td>
|
2638
|
-
<td>
|
2639
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 76</span>
|
2640
|
-
|
2641
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_valid_msg'>valid_msg</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
2642
|
-
<span class='id identifier rubyid_valid_msg_msg_type'>valid_msg_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
2643
|
-
<span class='kw'>end</span></pre>
|
2644
|
-
</td>
|
2645
|
-
</tr>
|
2646
|
-
</table>
|
2647
|
-
</div>
|
2648
|
-
|
2649
|
-
<div class="method_details ">
|
2650
|
-
<h3 class="signature " id="valid_msg_msg_type-instance_method">
|
2651
|
-
|
2652
|
-
#<strong>valid_msg_msg_type</strong>(msg) ⇒ <tt>Object</tt>
|
2653
|
-
|
2654
|
-
|
2655
|
-
|
2656
|
-
|
2657
|
-
|
2658
|
-
</h3><div class="docstring">
|
2659
|
-
<div class="discussion">
|
2660
|
-
|
2661
|
-
<p>Validates whether message type character of message is valid. Calls
|
2662
|
-
<span class='object_link'><a href="#valid_msg_type-instance_method" title="MaxCube::Messages::Handler#valid_msg_type (method)">#valid_msg_type</a></span> and #msg_msg_type (this method depends on conrete
|
2663
|
-
end-class).</p>
|
2664
|
-
|
2665
|
-
|
2666
|
-
</div>
|
2667
|
-
</div>
|
2668
|
-
<div class="tags">
|
2669
|
-
<p class="tag_title">Parameters:</p>
|
2670
|
-
<ul class="param">
|
2671
|
-
|
2672
|
-
<li>
|
2673
|
-
|
2674
|
-
<span class='name'>msg</span>
|
2675
|
-
|
2676
|
-
|
2677
|
-
<span class='type'>(<tt>String</tt>)</span>
|
2678
|
-
|
2679
|
-
|
2680
|
-
|
2681
|
-
—
|
2682
|
-
<div class='inline'>
|
2683
|
-
<p>input message.</p>
|
2684
|
-
</div>
|
2685
|
-
|
2686
|
-
</li>
|
2687
|
-
|
2688
|
-
</ul>
|
2689
|
-
|
2690
|
-
|
2691
|
-
</div><table class="source_code">
|
2692
|
-
<tr>
|
2693
|
-
<td>
|
2694
|
-
<pre class="lines">
|
2695
|
-
|
2696
|
-
|
2697
|
-
59
|
2698
|
-
60
|
2699
|
-
61</pre>
|
2700
|
-
</td>
|
2701
|
-
<td>
|
2702
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 59</span>
|
2703
|
-
|
2704
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_valid_msg_msg_type'>valid_msg_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
2705
|
-
<span class='id identifier rubyid_valid_msg_type'>valid_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_msg_type'>msg_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2706
|
-
<span class='kw'>end</span></pre>
|
2707
|
-
</td>
|
2708
|
-
</tr>
|
2709
|
-
</table>
|
2710
|
-
</div>
|
2711
|
-
|
2712
|
-
<div class="method_details ">
|
2713
|
-
<h3 class="signature " id="valid_msg_part_lengths-instance_method">
|
2714
|
-
|
2715
|
-
#<strong>valid_msg_part_lengths</strong>(lengths, *args) ⇒ <tt>Boolean</tt> <span class="extras">(private)</span>
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
</h3><div class="docstring">
|
2722
|
-
<div class="discussion">
|
2723
|
-
|
2724
|
-
<p>Checks whether given <code>args</code> satisfy lengths specified in input
|
2725
|
-
<code>lengths</code>. Missing positions in <code>lengths</code> means that
|
2726
|
-
no requirement is demanded at that index.</p>
|
2727
|
-
|
2728
|
-
|
2729
|
-
</div>
|
2730
|
-
</div>
|
2731
|
-
<div class="tags">
|
2732
|
-
<p class="tag_title">Parameters:</p>
|
2733
|
-
<ul class="param">
|
2734
|
-
|
2735
|
-
<li>
|
2736
|
-
|
2737
|
-
<span class='name'>lengths</span>
|
2738
|
-
|
2739
|
-
|
2740
|
-
<span class='type'>(<tt>Array<Integer></tt>)</span>
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
—
|
2745
|
-
<div class='inline'>
|
2746
|
-
<p>required lenghts of arguments.</p>
|
2747
|
-
</div>
|
2748
|
-
|
2749
|
-
</li>
|
2750
|
-
|
2751
|
-
<li>
|
2752
|
-
|
2753
|
-
<span class='name'>args</span>
|
2754
|
-
|
2755
|
-
|
2756
|
-
<span class='type'>(<tt>Array<#length></tt>)</span>
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
—
|
2761
|
-
<div class='inline'>
|
2762
|
-
<p>arguments to be validated.</p>
|
2763
|
-
</div>
|
2764
|
-
|
2765
|
-
</li>
|
2766
|
-
|
2767
|
-
</ul>
|
2768
|
-
|
2769
|
-
<p class="tag_title">Returns:</p>
|
2770
|
-
<ul class="return">
|
2771
|
-
|
2772
|
-
<li>
|
2773
|
-
|
2774
|
-
|
2775
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2779
|
-
—
|
2780
|
-
<div class='inline'>
|
2781
|
-
<p><code>true</code> if lengths of 'all' <code>args</code> fits to
|
2782
|
-
input <code>lengths</code>; <code>false</code> otherwise, or if any
|
2783
|
-
<code>arg</code> is <code>nil</code>, or if size of <code>lengths</code> is
|
2784
|
-
higher than number of <code>args</code>.</p>
|
2785
|
-
</div>
|
2786
|
-
|
2787
|
-
</li>
|
2788
|
-
|
2789
|
-
</ul>
|
2790
|
-
|
2791
|
-
</div><table class="source_code">
|
2792
|
-
<tr>
|
2793
|
-
<td>
|
2794
|
-
<pre class="lines">
|
2795
|
-
|
2796
|
-
|
2797
|
-
214
|
2798
|
-
215
|
2799
|
-
216
|
2800
|
-
217
|
2801
|
-
218
|
2802
|
-
219
|
2803
|
-
220</pre>
|
2804
|
-
</td>
|
2805
|
-
<td>
|
2806
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 214</span>
|
2807
|
-
|
2808
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_valid_msg_part_lengths'>valid_msg_part_lengths</span><span class='lparen'>(</span><span class='id identifier rubyid_lengths'>lengths</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
2809
|
-
<span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:nil?</span><span class='rparen'>)</span> <span class='op'>||</span>
|
2810
|
-
<span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'><</span> <span class='id identifier rubyid_lengths'>lengths</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
|
2811
|
-
<span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
2812
|
-
<span class='op'>!</span><span class='id identifier rubyid_lengths'>lengths</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='id identifier rubyid_lengths'>lengths</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span>
|
2813
|
-
<span class='kw'>end</span>
|
2814
|
-
<span class='kw'>end</span></pre>
|
2815
|
-
</td>
|
2816
|
-
</tr>
|
2817
|
-
</table>
|
2818
|
-
</div>
|
2819
|
-
|
2820
|
-
<div class="method_details ">
|
2821
|
-
<h3 class="signature " id="valid_msg_type-instance_method">
|
2822
|
-
|
2823
|
-
#<strong>valid_msg_type</strong>(msg_type) ⇒ <tt>Boolean</tt>
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
</h3><div class="docstring">
|
2830
|
-
<div class="discussion">
|
2831
|
-
|
2832
|
-
<p>Validates whether message type character is valid. Calls
|
2833
|
-
<span class='object_link'><a href="#maybe_check_valid_msg_type-instance_method" title="MaxCube::Messages::Handler#maybe_check_valid_msg_type (method)">#maybe_check_valid_msg_type</a></span>.</p>
|
2834
|
-
|
2835
|
-
|
2836
|
-
</div>
|
2837
|
-
</div>
|
2838
|
-
<div class="tags">
|
2839
|
-
<p class="tag_title">Parameters:</p>
|
2840
|
-
<ul class="param">
|
2841
|
-
|
2842
|
-
<li>
|
2843
|
-
|
2844
|
-
<span class='name'>msg_type</span>
|
2845
|
-
|
2846
|
-
|
2847
|
-
<span class='type'>(<tt>String</tt>)</span>
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
—
|
2852
|
-
<div class='inline'>
|
2853
|
-
<p>input message type character.</p>
|
2854
|
-
</div>
|
2855
|
-
|
2856
|
-
</li>
|
2857
|
-
|
2858
|
-
</ul>
|
2859
|
-
|
2860
|
-
<p class="tag_title">Returns:</p>
|
2861
|
-
<ul class="return">
|
2862
|
-
|
2863
|
-
<li>
|
2864
|
-
|
2865
|
-
|
2866
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
2867
|
-
|
2868
|
-
|
2869
|
-
|
2870
|
-
—
|
2871
|
-
<div class='inline'>
|
2872
|
-
<p><code>true</code> if argument is valid message type.</p>
|
2873
|
-
</div>
|
2874
|
-
|
2875
|
-
</li>
|
2876
|
-
|
2877
|
-
</ul>
|
2878
|
-
|
2879
|
-
</div><table class="source_code">
|
2880
|
-
<tr>
|
2881
|
-
<td>
|
2882
|
-
<pre class="lines">
|
2883
|
-
|
2884
|
-
|
2885
|
-
40
|
2886
|
-
41
|
2887
|
-
42</pre>
|
2888
|
-
</td>
|
2889
|
-
<td>
|
2890
|
-
<pre class="code"><span class="info file"># File 'lib/maxcube/messages/handler.rb', line 40</span>
|
2891
|
-
|
2892
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_valid_msg_type'>valid_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='rparen'>)</span>
|
2893
|
-
<span class='id identifier rubyid_maybe_check_valid_msg_type'>maybe_check_valid_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg_type'>msg_type</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
2894
|
-
<span class='kw'>end</span></pre>
|
2895
|
-
</td>
|
2896
|
-
</tr>
|
2897
|
-
</table>
|
2898
|
-
</div>
|
2899
|
-
|
2900
|
-
</div>
|
2901
|
-
|
2902
|
-
</div>
|
2903
|
-
|
2904
|
-
<div id="footer">
|
2905
|
-
Generated on Fri Feb 16 13:44:01 2018 by
|
2906
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2907
|
-
0.9.12 (ruby-2.5.0).
|
2908
|
-
</div>
|
2909
|
-
|
2910
|
-
</div>
|
2911
|
-
</body>
|
2912
|
-
</html>
|