cosmos-unpacking_interface 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +7 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +158 -0
  7. data/Rakefile +12 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/config/data/README.txt +1 -0
  11. data/config/data/crc.txt +198 -0
  12. data/config/system/system.txt +29 -0
  13. data/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -0
  14. data/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -0
  15. data/config/targets/COSMOS/cmd_tlm_server.txt +6 -0
  16. data/config/targets/COSMOS/screens/limits_change.txt +20 -0
  17. data/config/targets/COSMOS/screens/version.txt +19 -0
  18. data/config/targets/COSMOS/target.txt +9 -0
  19. data/config/targets/PI/cmd_tlm/pi_tlm_test.txt +12 -0
  20. data/config/targets/PI/cmd_tlm/pi_tlm_test_1.txt +13 -0
  21. data/config/targets/PI/cmd_tlm/pi_tlm_test_2.txt +68 -0
  22. data/config/targets/PI/cmd_tlm/pi_tlm_test_3.txt +12 -0
  23. data/config/targets/PI/cmd_tlm_server.txt +4 -0
  24. data/config/targets/PI/target.txt +4 -0
  25. data/cosmos-unpacking_interface.gemspec +34 -0
  26. data/doc/Cosmos.html +98 -0
  27. data/doc/Cosmos/AggregatePacketMapper.html +152 -0
  28. data/doc/Cosmos/AggregatePacketProcesser.html +249 -0
  29. data/doc/Cosmos/BaseNameMap.html +364 -0
  30. data/doc/Cosmos/UnpackingInterface.html +399 -0
  31. data/doc/UnpackingInterface.html +110 -0
  32. data/doc/created.rid +7 -0
  33. data/doc/css/fonts.css +167 -0
  34. data/doc/css/rdoc.css +590 -0
  35. data/doc/fonts/Lato-Light.ttf +0 -0
  36. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  37. data/doc/fonts/Lato-Regular.ttf +0 -0
  38. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  39. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  40. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  41. data/doc/images/add.png +0 -0
  42. data/doc/images/arrow_up.png +0 -0
  43. data/doc/images/brick.png +0 -0
  44. data/doc/images/brick_link.png +0 -0
  45. data/doc/images/bug.png +0 -0
  46. data/doc/images/bullet_black.png +0 -0
  47. data/doc/images/bullet_toggle_minus.png +0 -0
  48. data/doc/images/bullet_toggle_plus.png +0 -0
  49. data/doc/images/date.png +0 -0
  50. data/doc/images/delete.png +0 -0
  51. data/doc/images/find.png +0 -0
  52. data/doc/images/loadingAnimation.gif +0 -0
  53. data/doc/images/macFFBgHack.png +0 -0
  54. data/doc/images/package.png +0 -0
  55. data/doc/images/page_green.png +0 -0
  56. data/doc/images/page_white_text.png +0 -0
  57. data/doc/images/page_white_width.png +0 -0
  58. data/doc/images/plugin.png +0 -0
  59. data/doc/images/ruby.png +0 -0
  60. data/doc/images/tag_blue.png +0 -0
  61. data/doc/images/tag_green.png +0 -0
  62. data/doc/images/transparent.png +0 -0
  63. data/doc/images/wrench.png +0 -0
  64. data/doc/images/wrench_orange.png +0 -0
  65. data/doc/images/zoom.png +0 -0
  66. data/doc/index.html +91 -0
  67. data/doc/js/darkfish.js +161 -0
  68. data/doc/js/jquery.js +4 -0
  69. data/doc/js/navigation.js +141 -0
  70. data/doc/js/navigation.js.gz +0 -0
  71. data/doc/js/search.js +109 -0
  72. data/doc/js/search_index.js +1 -0
  73. data/doc/js/search_index.js.gz +0 -0
  74. data/doc/js/searcher.js +229 -0
  75. data/doc/js/searcher.js.gz +0 -0
  76. data/doc/lib/README_rdoc.html +118 -0
  77. data/doc/table_of_contents.html +140 -0
  78. data/lib/cosmos/unpacking_interface.rb +14 -0
  79. data/lib/cosmos/unpacking_interface/aggregate_packet_mapper.rb +14 -0
  80. data/lib/cosmos/unpacking_interface/aggregate_packet_processor.rb +42 -0
  81. data/lib/cosmos/unpacking_interface/base_name_map.rb +67 -0
  82. data/lib/cosmos/unpacking_interface/unpacking_interface.rb +87 -0
  83. data/lib/cosmos/unpacking_interface/version.rb +3 -0
  84. metadata +174 -0
@@ -0,0 +1,249 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Cosmos::AggregatePacketProcesser - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ var index_rel_prefix = "../";
12
+ </script>
13
+
14
+ <script src="../js/jquery.js"></script>
15
+ <script src="../js/darkfish.js"></script>
16
+
17
+ <link href="../css/fonts.css" rel="stylesheet">
18
+ <link href="../css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="class">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="../index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="../table_of_contents.html#pages">Pages</a>
32
+ <a href="../table_of_contents.html#classes">Classes</a>
33
+ <a href="../table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+ <div id="parent-class-section" class="nav-section">
59
+ <h3>Parent</h3>
60
+
61
+
62
+ <p class="link">Object
63
+
64
+ </div>
65
+
66
+
67
+
68
+ <!-- Method Quickref -->
69
+ <div id="method-list-section" class="nav-section">
70
+ <h3>Methods</h3>
71
+
72
+ <ul class="link-list" role="directory">
73
+
74
+ <li ><a href="#method-c-new">::new</a>
75
+
76
+ <li ><a href="#method-i-_extract_map">#_extract_map</a>
77
+
78
+ <li ><a href="#method-i-unpack">#unpack</a>
79
+
80
+ </ul>
81
+ </div>
82
+
83
+ </div>
84
+ </nav>
85
+
86
+ <main role="main" aria-labelledby="class-Cosmos::AggregatePacketProcesser">
87
+ <h1 id="class-Cosmos::AggregatePacketProcesser" class="class">
88
+ class Cosmos::AggregatePacketProcesser
89
+ </h1>
90
+
91
+ <section class="description">
92
+
93
+ <p>Encapsulates the transformation of an aggregate packet into many simple packets</p>
94
+
95
+ </section>
96
+
97
+
98
+ <section id="5Buntitled-5D" class="documentation-section">
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
109
+ <header>
110
+ <h3>Public Class Methods</h3>
111
+ </header>
112
+
113
+
114
+ <div id="method-c-new" class="method-detail ">
115
+
116
+ <div class="method-heading">
117
+ <span class="method-name">new</span><span
118
+ class="method-args">(mapper, transforms = {})</span>
119
+
120
+ <span class="method-click-advice">click to toggle source</span>
121
+
122
+ </div>
123
+
124
+
125
+ <div class="method-description">
126
+
127
+
128
+
129
+
130
+
131
+
132
+ <div class="method-source-code" id="new-source">
133
+ <pre><span class="ruby-comment"># File lib/cosmos/unpacking_interface/aggregate_packet_processor.rb, line 8</span>
134
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">mapper</span>, <span class="ruby-identifier">transforms</span> = {})
135
+ <span class="ruby-ivar">@mapper</span> = <span class="ruby-identifier">mapper</span>
136
+ <span class="ruby-ivar">@transforms</span> = <span class="ruby-identifier">transforms</span>
137
+ <span class="ruby-keyword">end</span></pre>
138
+ </div>
139
+
140
+ </div>
141
+
142
+
143
+
144
+
145
+ </div>
146
+
147
+
148
+ </section>
149
+
150
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
151
+ <header>
152
+ <h3>Public Instance Methods</h3>
153
+ </header>
154
+
155
+
156
+ <div id="method-i-_extract_map" class="method-detail ">
157
+
158
+ <div class="method-heading">
159
+ <span class="method-name">_extract_map</span><span
160
+ class="method-args">(map, target, item)</span>
161
+
162
+ <span class="method-click-advice">click to toggle source</span>
163
+
164
+ </div>
165
+
166
+
167
+ <div class="method-description">
168
+
169
+ <p>Extract our internal <a href="BaseNameMap.html"><code>BaseNameMap</code></a> into an array of packets of type target/item, applying transformations if applicable</p>
170
+
171
+
172
+
173
+
174
+ <div class="method-source-code" id="_extract_map-source">
175
+ <pre><span class="ruby-comment"># File lib/cosmos/unpacking_interface/aggregate_packet_processor.rb, line 23</span>
176
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_extract_map</span>(<span class="ruby-identifier">map</span>, <span class="ruby-identifier">target</span>, <span class="ruby-identifier">item</span>)
177
+ <span class="ruby-identifier">map</span>.<span class="ruby-identifier">extract_all</span>.<span class="ruby-identifier">each_with_index</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
178
+ <span class="ruby-identifier">keys</span> = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">keys</span>
179
+ <span class="ruby-identifier">pkt</span> = <span class="ruby-constant">System</span>.<span class="ruby-identifier">telemetry</span>.<span class="ruby-identifier">packet</span>(<span class="ruby-identifier">target</span>, <span class="ruby-identifier">item</span>).<span class="ruby-identifier">clone</span>
180
+
181
+ <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">reduce</span>(<span class="ruby-identifier">pkt</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span>, <span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
182
+ <span class="ruby-identifier">value</span> = <span class="ruby-identifier">m</span>[<span class="ruby-identifier">key</span>]
183
+ <span class="ruby-identifier">transform_key</span> = [<span class="ruby-identifier">target</span>, <span class="ruby-identifier">item</span>, <span class="ruby-identifier">key</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;-&quot;</span>)
184
+
185
+ <span class="ruby-keyword">if</span> <span class="ruby-ivar">@transforms</span>[<span class="ruby-identifier">transform_key</span>]
186
+ <span class="ruby-identifier">p</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">key</span>, <span class="ruby-ivar">@transforms</span>[<span class="ruby-identifier">transform_key</span>].<span class="ruby-identifier">call</span>(<span class="ruby-identifier">target</span>, <span class="ruby-identifier">item</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">i</span>))
187
+ <span class="ruby-keyword">else</span>
188
+ <span class="ruby-identifier">p</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
189
+ <span class="ruby-keyword">end</span>
190
+ <span class="ruby-identifier">p</span>
191
+ <span class="ruby-keyword">end</span>
192
+ <span class="ruby-keyword">end</span>
193
+ <span class="ruby-keyword">end</span></pre>
194
+ </div>
195
+
196
+ </div>
197
+
198
+
199
+
200
+
201
+ </div>
202
+
203
+
204
+ <div id="method-i-unpack" class="method-detail ">
205
+
206
+ <div class="method-heading">
207
+ <span class="method-name">unpack</span><span
208
+ class="method-args">(packet, target, item)</span>
209
+
210
+ <span class="method-click-advice">click to toggle source</span>
211
+
212
+ </div>
213
+
214
+
215
+ <div class="method-description">
216
+
217
+ <p>Converts the aggregate packet into an array of simple packets.</p>
218
+
219
+
220
+
221
+
222
+ <div class="method-source-code" id="unpack-source">
223
+ <pre><span class="ruby-comment"># File lib/cosmos/unpacking_interface/aggregate_packet_processor.rb, line 15</span>
224
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unpack</span>(<span class="ruby-identifier">packet</span>, <span class="ruby-identifier">target</span>, <span class="ruby-identifier">item</span>)
225
+ <span class="ruby-identifier">values_map</span> = <span class="ruby-ivar">@mapper</span>.<span class="ruby-identifier">build_map</span>(<span class="ruby-identifier">packet</span>) <span class="ruby-comment">#</span>
226
+ <span class="ruby-identifier">_extract_map</span>(<span class="ruby-identifier">values_map</span>, <span class="ruby-identifier">target</span>, <span class="ruby-identifier">item</span>)
227
+ <span class="ruby-keyword">end</span></pre>
228
+ </div>
229
+
230
+ </div>
231
+
232
+
233
+
234
+
235
+ </div>
236
+
237
+
238
+ </section>
239
+
240
+ </section>
241
+ </main>
242
+
243
+
244
+ <footer id="validator-badges" role="contentinfo">
245
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
246
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.1.
247
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
248
+ </footer>
249
+
@@ -0,0 +1,364 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Cosmos::BaseNameMap - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ var index_rel_prefix = "../";
12
+ </script>
13
+
14
+ <script src="../js/jquery.js"></script>
15
+ <script src="../js/darkfish.js"></script>
16
+
17
+ <link href="../css/fonts.css" rel="stylesheet">
18
+ <link href="../css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="class">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="../index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="../table_of_contents.html#pages">Pages</a>
32
+ <a href="../table_of_contents.html#classes">Classes</a>
33
+ <a href="../table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+ <div id="parent-class-section" class="nav-section">
59
+ <h3>Parent</h3>
60
+
61
+
62
+ <p class="link">Object
63
+
64
+ </div>
65
+
66
+
67
+
68
+ <!-- Method Quickref -->
69
+ <div id="method-list-section" class="nav-section">
70
+ <h3>Methods</h3>
71
+
72
+ <ul class="link-list" role="directory">
73
+
74
+ <li ><a href="#method-c-new">::new</a>
75
+
76
+ <li ><a href="#method-i-_field_arity">#_field_arity</a>
77
+
78
+ <li ><a href="#method-i-_max_arity">#_max_arity</a>
79
+
80
+ <li ><a href="#method-i-extract_all">#extract_all</a>
81
+
82
+ <li ><a href="#method-i-size">#size</a>
83
+
84
+ </ul>
85
+ </div>
86
+
87
+ </div>
88
+ </nav>
89
+
90
+ <main role="main" aria-labelledby="class-Cosmos::BaseNameMap">
91
+ <h1 id="class-Cosmos::BaseNameMap" class="class">
92
+ class Cosmos::BaseNameMap
93
+ </h1>
94
+
95
+ <section class="description">
96
+
97
+ </section>
98
+
99
+
100
+ <section id="5Buntitled-5D" class="documentation-section">
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ <section class="attribute-method-details" class="method-section">
109
+ <header>
110
+ <h3>Attributes</h3>
111
+ </header>
112
+
113
+
114
+ <div id="attribute-i-map" class="method-detail">
115
+ <div class="method-heading attribute-method-heading">
116
+ <span class="method-name">map</span><span
117
+ class="attribute-access-type">[RW]</span>
118
+ </div>
119
+
120
+ <div class="method-description">
121
+
122
+
123
+
124
+ </div>
125
+ </div>
126
+
127
+ <div id="attribute-i-name" class="method-detail">
128
+ <div class="method-heading attribute-method-heading">
129
+ <span class="method-name">name</span><span
130
+ class="attribute-access-type">[RW]</span>
131
+ </div>
132
+
133
+ <div class="method-description">
134
+
135
+
136
+
137
+ </div>
138
+ </div>
139
+
140
+ </section>
141
+
142
+
143
+
144
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
145
+ <header>
146
+ <h3>Public Class Methods</h3>
147
+ </header>
148
+
149
+
150
+ <div id="method-c-new" class="method-detail ">
151
+
152
+ <div class="method-heading">
153
+ <span class="method-name">new</span><span
154
+ class="method-args">(map, name)</span>
155
+
156
+ <span class="method-click-advice">click to toggle source</span>
157
+
158
+ </div>
159
+
160
+
161
+ <div class="method-description">
162
+
163
+ <p>map is a hash where keys are normalized item names (i.e. VALUE_A instead of VALUE_A_0) and values are arrays of all the values whose original keys (VALUE_A_x) mapped to that value. For example: { &#39;VALUE_A&#39; =&gt; [1,2,3]}.</p>
164
+
165
+ <p>name is the name of the packet</p>
166
+
167
+
168
+
169
+
170
+ <div class="method-source-code" id="new-source">
171
+ <pre><span class="ruby-comment"># File lib/cosmos/unpacking_interface/base_name_map.rb, line 13</span>
172
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">map</span>, <span class="ruby-identifier">name</span>)
173
+ <span class="ruby-ivar">@map</span> = <span class="ruby-identifier">map</span>
174
+ <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span> <span class="ruby-comment"># packet name</span>
175
+ <span class="ruby-keyword">end</span></pre>
176
+ </div>
177
+
178
+ </div>
179
+
180
+
181
+
182
+
183
+ </div>
184
+
185
+
186
+ </section>
187
+
188
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
189
+ <header>
190
+ <h3>Public Instance Methods</h3>
191
+ </header>
192
+
193
+
194
+ <div id="method-i-_field_arity" class="method-detail ">
195
+
196
+ <div class="method-heading">
197
+ <span class="method-name">_field_arity</span><span
198
+ class="method-args">(k)</span>
199
+
200
+ <span class="method-click-advice">click to toggle source</span>
201
+
202
+ </div>
203
+
204
+
205
+ <div class="method-description">
206
+
207
+
208
+
209
+
210
+
211
+
212
+ <div class="method-source-code" id="_field_arity-source">
213
+ <pre><span class="ruby-comment"># File lib/cosmos/unpacking_interface/base_name_map.rb, line 33</span>
214
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_field_arity</span>(<span class="ruby-identifier">k</span>)
215
+ <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@map</span>[<span class="ruby-identifier">k</span>]
216
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">nil?</span>
217
+ <span class="ruby-value">0</span>
218
+ <span class="ruby-keyword">else</span>
219
+ <span class="ruby-identifier">result</span>.<span class="ruby-identifier">length</span>
220
+ <span class="ruby-keyword">end</span>
221
+ <span class="ruby-keyword">end</span></pre>
222
+ </div>
223
+
224
+ </div>
225
+
226
+
227
+
228
+
229
+ </div>
230
+
231
+
232
+ <div id="method-i-_max_arity" class="method-detail ">
233
+
234
+ <div class="method-heading">
235
+ <span class="method-name">_max_arity</span><span
236
+ class="method-args">()</span>
237
+
238
+ <span class="method-click-advice">click to toggle source</span>
239
+
240
+ </div>
241
+
242
+
243
+ <div class="method-description">
244
+
245
+
246
+
247
+
248
+
249
+
250
+ <div class="method-source-code" id="_max_arity-source">
251
+ <pre><span class="ruby-comment"># File lib/cosmos/unpacking_interface/base_name_map.rb, line 28</span>
252
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_max_arity</span>
253
+ <span class="ruby-keyword">return</span> <span class="ruby-value">0</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@map</span>.<span class="ruby-identifier">empty?</span>
254
+ <span class="ruby-ivar">@map</span>.<span class="ruby-identifier">max_by</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">length</span>}.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">length</span>
255
+ <span class="ruby-keyword">end</span></pre>
256
+ </div>
257
+
258
+ </div>
259
+
260
+
261
+
262
+
263
+ </div>
264
+
265
+
266
+ <div id="method-i-extract_all" class="method-detail ">
267
+
268
+ <div class="method-heading">
269
+ <span class="method-name">extract_all</span><span
270
+ class="method-args">()</span>
271
+
272
+ <span class="method-click-advice">click to toggle source</span>
273
+
274
+ </div>
275
+
276
+
277
+ <div class="method-description">
278
+
279
+ <p>Expands map of keys to arrays of values into a single array containing hashes where each key maps to only a single value i.e. {&#39;VALUE_A&#39; =&gt; [1,2]} =&gt; [{&#39;VALUE_A&#39; =&gt; 1}, {&#39;VALUE_A&#39; =&gt; 2}]</p>
280
+
281
+
282
+
283
+
284
+ <div class="method-source-code" id="extract_all-source">
285
+ <pre><span class="ruby-comment"># File lib/cosmos/unpacking_interface/base_name_map.rb, line 46</span>
286
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">extract_all</span>
287
+ <span class="ruby-identifier">max</span> = <span class="ruby-identifier">_max_arity</span>
288
+ <span class="ruby-identifier">range</span> = <span class="ruby-keyword">if</span>(<span class="ruby-identifier">max</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>)
289
+ [<span class="ruby-operator">*</span><span class="ruby-value">0</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">max</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)]
290
+ <span class="ruby-keyword">else</span>
291
+ [<span class="ruby-value">0</span>]
292
+ <span class="ruby-keyword">end</span>
293
+
294
+ <span class="ruby-identifier">range</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
295
+ <span class="ruby-identifier">keys</span> = <span class="ruby-ivar">@map</span>.<span class="ruby-identifier">keys</span>
296
+ <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">reduce</span>({}) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">acc</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
297
+ <span class="ruby-keyword">if</span>(<span class="ruby-identifier">_field_arity</span>(<span class="ruby-identifier">k</span>) <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
298
+ <span class="ruby-identifier">acc</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-ivar">@map</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">first</span>
299
+ <span class="ruby-keyword">else</span>
300
+ <span class="ruby-identifier">acc</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-ivar">@map</span>[<span class="ruby-identifier">k</span>][<span class="ruby-identifier">i</span>]
301
+ <span class="ruby-keyword">end</span>
302
+ <span class="ruby-identifier">acc</span>
303
+ <span class="ruby-keyword">end</span>
304
+ <span class="ruby-keyword">end</span>
305
+ <span class="ruby-keyword">end</span></pre>
306
+ </div>
307
+
308
+ </div>
309
+
310
+
311
+
312
+
313
+ </div>
314
+
315
+
316
+ <div id="method-i-size" class="method-detail ">
317
+
318
+ <div class="method-heading">
319
+ <span class="method-name">size</span><span
320
+ class="method-args">()</span>
321
+
322
+ <span class="method-click-advice">click to toggle source</span>
323
+
324
+ </div>
325
+
326
+
327
+ <div class="method-description">
328
+
329
+ <p>Number of simple packets contained within the aggregate packet</p>
330
+
331
+
332
+
333
+
334
+ <div class="method-source-code" id="size-source">
335
+ <pre><span class="ruby-comment"># File lib/cosmos/unpacking_interface/base_name_map.rb, line 20</span>
336
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">size</span>
337
+ <span class="ruby-keyword">if</span> <span class="ruby-ivar">@map</span>.<span class="ruby-identifier">empty?</span>
338
+ <span class="ruby-keyword">return</span> <span class="ruby-value">0</span>
339
+ <span class="ruby-keyword">else</span>
340
+ <span class="ruby-identifier">_max_arity</span>
341
+ <span class="ruby-keyword">end</span>
342
+ <span class="ruby-keyword">end</span></pre>
343
+ </div>
344
+
345
+ </div>
346
+
347
+
348
+
349
+
350
+ </div>
351
+
352
+
353
+ </section>
354
+
355
+ </section>
356
+ </main>
357
+
358
+
359
+ <footer id="validator-badges" role="contentinfo">
360
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
361
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.1.
362
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
363
+ </footer>
364
+