boris 1.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/LICENSE.md +9 -0
  2. data/README.md +94 -0
  3. data/boris.gemspec +28 -0
  4. data/doc/Array.html +437 -0
  5. data/doc/Boris.html +230 -0
  6. data/doc/Boris/ConnectionAlreadyActive.html +123 -0
  7. data/doc/Boris/ConnectionFailed.html +127 -0
  8. data/doc/Boris/Connector.html +794 -0
  9. data/doc/Boris/InvalidCredentials.html +131 -0
  10. data/doc/Boris/InvalidOption.html +123 -0
  11. data/doc/Boris/InvalidTargetName.html +123 -0
  12. data/doc/Boris/Lumberjack.html +466 -0
  13. data/doc/Boris/MissingCredentials.html +123 -0
  14. data/doc/Boris/NoActiveConnection.html +123 -0
  15. data/doc/Boris/NoProfileDetected.html +123 -0
  16. data/doc/Boris/Options.html +783 -0
  17. data/doc/Boris/Profiles.html +117 -0
  18. data/doc/Boris/Profiles/Linux.html +1151 -0
  19. data/doc/Boris/Profiles/RedHat.html +875 -0
  20. data/doc/Boris/Profiles/Solaris.html +1230 -0
  21. data/doc/Boris/Profiles/Structure.html +2050 -0
  22. data/doc/Boris/Profiles/UNIX.html +893 -0
  23. data/doc/Boris/Profiles/Windows.html +1846 -0
  24. data/doc/Boris/Profiles/Windows/Windows2003.html +304 -0
  25. data/doc/Boris/Profiles/Windows/Windows2008.html +379 -0
  26. data/doc/Boris/Profiles/Windows/Windows2012.html +304 -0
  27. data/doc/Boris/SNMPConnector.html +512 -0
  28. data/doc/Boris/SSHConnector.html +633 -0
  29. data/doc/Boris/Target.html +2002 -0
  30. data/doc/Boris/WMIConnector.html +1134 -0
  31. data/doc/BorisLogger.html +217 -0
  32. data/doc/Hash.html +195 -0
  33. data/doc/String.html +1246 -0
  34. data/doc/_index.html +420 -0
  35. data/doc/class_list.html +53 -0
  36. data/doc/css/common.css +1 -0
  37. data/doc/css/full_list.css +57 -0
  38. data/doc/css/style.css +328 -0
  39. data/doc/file.README.html +183 -0
  40. data/doc/file_list.html +55 -0
  41. data/doc/frames.html +28 -0
  42. data/doc/index.html +183 -0
  43. data/doc/js/app.js +214 -0
  44. data/doc/js/full_list.js +173 -0
  45. data/doc/js/jquery.js +4 -0
  46. data/doc/method_list.html +1468 -0
  47. data/doc/top-level-namespace.html +126 -0
  48. data/lib/boris.rb +30 -0
  49. data/lib/boris/connectors.rb +47 -0
  50. data/lib/boris/connectors/snmp.rb +56 -0
  51. data/lib/boris/connectors/ssh.rb +110 -0
  52. data/lib/boris/connectors/wmi.rb +186 -0
  53. data/lib/boris/errors.rb +17 -0
  54. data/lib/boris/helpers/array.rb +63 -0
  55. data/lib/boris/helpers/constants.rb +20 -0
  56. data/lib/boris/helpers/hash.rb +8 -0
  57. data/lib/boris/helpers/scrubber.rb +51 -0
  58. data/lib/boris/helpers/string.rb +130 -0
  59. data/lib/boris/lumberjack.rb +47 -0
  60. data/lib/boris/options.rb +86 -0
  61. data/lib/boris/profiles/linux/redhat.rb +77 -0
  62. data/lib/boris/profiles/linux_core.rb +216 -0
  63. data/lib/boris/profiles/unix/solaris.rb +307 -0
  64. data/lib/boris/profiles/unix_core.rb +85 -0
  65. data/lib/boris/profiles/windows/windows2003.rb +15 -0
  66. data/lib/boris/profiles/windows/windows2008.rb +23 -0
  67. data/lib/boris/profiles/windows/windows2012.rb +15 -0
  68. data/lib/boris/profiles/windows_core.rb +530 -0
  69. data/lib/boris/structure.rb +167 -0
  70. data/lib/boris/target.rb +340 -0
  71. data/test/connector_tests/test_snmp.rb +35 -0
  72. data/test/connector_tests/test_ssh.rb +51 -0
  73. data/test/connector_tests/test_wmi.rb +129 -0
  74. data/test/helper_tests/test_array.rb +25 -0
  75. data/test/helper_tests/test_hash.rb +10 -0
  76. data/test/helper_tests/test_string.rb +136 -0
  77. data/test/profile_tests/test_core_skeleton +107 -0
  78. data/test/profile_tests/test_linux_core.rb +331 -0
  79. data/test/profile_tests/test_redhat.rb +134 -0
  80. data/test/profile_tests/test_solaris.rb +523 -0
  81. data/test/profile_tests/test_unix_core.rb +117 -0
  82. data/test/profile_tests/test_windows.rb +536 -0
  83. data/test/setup_tests.rb +14 -0
  84. data/test/test_all.rb +8 -0
  85. data/test/test_options.rb +44 -0
  86. data/test/test_structure.rb +136 -0
  87. data/test/test_target.rb +146 -0
  88. metadata +241 -0
data/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2013 Joe Martin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # Boris
2
+ ## A networked-device scanning solution
3
+
4
+ * Code: http://github.com/alkalinecoffee/boris
5
+ * Documentation: http://rdoc.info/github/alkalinecoffee/boris/master/frames
6
+ * Issues: https://github.com/alkalinecoffee/boris/issues
7
+
8
+ ## Introduction
9
+ Boris is a library that facilitates the communication between you and various networked devices over SNMP, SSH and WMI, pulling a large amount of configuration items including installed software, network settings, serial numbers, user accounts, disk utilization, and more.
10
+
11
+ Out of the box, Boris has server support for Windows, Red Hat, and Solaris (with other platforms available with future plugins), with a focus on returning precisely formatted data, no matter which platforms your organization may have deployed. Through the use of profiles, Boris can easily be extended by the developer to include other platforms. Highly suitable for small and large environments alike looking to pull configuration data from various platforms.
12
+
13
+ ## Features
14
+ * Out of the box, pulls information from RedHat Linux, Solaris 10, and Windows servers
15
+ * Utilizes SNMP, SSH, and WMI communication technologies
16
+ * Expandable to include other networked devices, such as switches, load balancers, and other operating systems
17
+
18
+ ## Installation
19
+ gem install boris
20
+
21
+ ## Example
22
+ Let's pull some information from a RedHat Enterprise Linux server on our network:
23
+
24
+ ```ruby
25
+ require 'boris'
26
+
27
+ target = Boris::Target.new('redhatserver01.mydomain.com')
28
+
29
+ # let's use a helper to suggest how we should connect to it (which is useful if we're not sure what
30
+ # kind of device this is)
31
+ puts target.suggested_connection_method
32
+
33
+ # you can also add the logic to make the decision yourself by checking if certain TCP ports are responsive
34
+ puts target.tcp_port_responding?(22)
35
+
36
+ # add credentials to try against this target
37
+ target.options.add_credential(:user=>'joe', :password=>'mypassword', :connection_types=>[:ssh])
38
+
39
+ # attempt to connect to this target using the credentials we supplied above
40
+ target.connect
41
+
42
+ if target.connected?
43
+ # detect which profile to load up (is this target running windows? solaris? or what?). if we can't
44
+ # detect a suitable profile, this will throw an error
45
+ target.detect_profile
46
+
47
+ puts target.target_profile
48
+
49
+ # we can call individual methods to grab specific information we may be interested in (or call
50
+ # #retrieve_all to grab everything we can)
51
+ target.get_hardware
52
+
53
+ puts target.hardware.inspect
54
+
55
+ # finally, we can package up all of the data into json format for portability
56
+ puts target.to_json
57
+ end
58
+
59
+ target.disconnect
60
+ ```
61
+
62
+ ## Data
63
+ Through a number of queries and algorithms, Boris effeciently polls devices on the network for information including, but not limited to, network configuration, hardware capabilities, installed software and services, applied hotfixes/patches, and more.
64
+
65
+ **Available methods for use on most platforms include:**
66
+
67
+ * **file systems** - file system, mount point, capacity and utilization
68
+ * **hardware** - make/model, cpu information, firmware/bios version, serial number
69
+ * **hosted shares** - folders shared by the target
70
+ * **installed applications** - installed applications and the dates of their installation
71
+ * **installed patches** - installed patches/hotfixes and the dates of their installation
72
+ * **installed services/daemons** - background services and their startup modes
73
+ * **local users and groups** - local groups and the member users within each
74
+ * **network ID** - hostname and domain
75
+ * **network interfaces** - ethernet and fibre channel interfaces, including IPs, MAC addresses, connection status
76
+ * **operating system** - name, version, kernel, date installed
77
+
78
+ See {Boris::Profiles::Structure} for more details on the data structure.
79
+
80
+ Because the commands that might work correctly on one type of platform most likely won't work on another, Boris handles this by the use of...
81
+
82
+ ## Profiles
83
+ Profiles contain the instructions that allow us to run commands against our target and then parse and make sense of the data. Boris comes with the capability to communicate with targets over SNMP, SSH, or WMI. Each profile is written to use one of these methods of communication (internally called 'connectors'), which serve as a vehicle for running commands against a server. Boris comes with a few profiles built-in for some popular platforms, but can be easily extended to include other devices.
84
+
85
+ ## Requirements
86
+ * Ruby 1.9.3 (only tested on MRI)
87
+ * Net/SSH gem
88
+ * NetAddr gem
89
+ * SNMP gem
90
+ * Mocha (for tests only)
91
+ * Shoulda (for tests only)
92
+
93
+ ## LICENSE
94
+ This software is provided under the MIT license. See the LICENSE.md file.
data/boris.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'boris'
3
+ s.version = '1.0.0.beta.1'
4
+ s.summary = 'Boris: A networked-device scanning library.'
5
+ s.description = s.summary + ' Boris allows you to write programs for logging into and pulling information off of various server platforms, appliances, and other types of networked devices, producing clean and consistent data ideal for configuration managment usage.'
6
+
7
+ s.author = 'Joe Martin'
8
+ s.email = 'jwmartin83@gmail.com'
9
+ s.homepage = 'https://github.com/alkalinecoffee/boris'
10
+
11
+ s.required_ruby_version = '>= 1.9.3'
12
+
13
+ s.requirements << 'netaddr'
14
+ s.requirements << 'net/ssh'
15
+ s.requirements << 'snmp'
16
+
17
+ s.add_runtime_dependency 'netaddr'
18
+ s.add_runtime_dependency 'net-ssh'
19
+ s.add_runtime_dependency 'snmp'
20
+
21
+ s.add_development_dependency 'mocha'
22
+ s.add_development_dependency 'shoulda'
23
+
24
+ s.require_paths = %w[lib]
25
+
26
+ s.files = Dir.glob("{.,bin,lib}/**/*")
27
+
28
+ end
data/doc/Array.html ADDED
@@ -0,0 +1,437 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: Array
8
+
9
+ &mdash; Documentation by YARD 0.8.3
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (A)</a> &raquo;
35
+
36
+
37
+ <span class="title">Array</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: Array
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">Array</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/boris/helpers/array.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+ <h2>
111
+ Instance Method Summary
112
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
113
+ </h2>
114
+
115
+ <ul class="summary">
116
+
117
+ <li class="public ">
118
+ <span class="summary_signature">
119
+
120
+ <a href="#strip_string_values_in_array-instance_method" title="#strip_string_values_in_array (instance method)">- (Object) <strong>strip_string_values_in_array</strong> </a>
121
+
122
+
123
+
124
+ </span>
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+ <span class="summary_desc"><div class='inline'></div></span>
135
+
136
+ </li>
137
+
138
+
139
+ <li class="public ">
140
+ <span class="summary_signature">
141
+
142
+ <a href="#to_ms_product_key-instance_method" title="#to_ms_product_key (instance method)">- (Object) <strong>to_ms_product_key</strong> </a>
143
+
144
+
145
+
146
+ </span>
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+ <span class="summary_desc"><div class='inline'></div></span>
157
+
158
+ </li>
159
+
160
+
161
+ <li class="public ">
162
+ <span class="summary_signature">
163
+
164
+ <a href="#to_nil_hash-instance_method" title="#to_nil_hash (instance method)">- (Object) <strong>to_nil_hash</strong> </a>
165
+
166
+
167
+
168
+ </span>
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+ <span class="summary_desc"><div class='inline'></div></span>
179
+
180
+ </li>
181
+
182
+
183
+ <li class="public ">
184
+ <span class="summary_signature">
185
+
186
+ <a href="#to_wwn-instance_method" title="#to_wwn (instance method)">- (Object) <strong>to_wwn</strong> </a>
187
+
188
+
189
+
190
+ </span>
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+ <span class="summary_desc"><div class='inline'></div></span>
201
+
202
+ </li>
203
+
204
+
205
+ </ul>
206
+
207
+
208
+
209
+
210
+ <div id="instance_method_details" class="method_details_list">
211
+ <h2>Instance Method Details</h2>
212
+
213
+
214
+ <div class="method_details first">
215
+ <h3 class="signature first" id="strip_string_values_in_array-instance_method">
216
+
217
+ - (<tt>Object</tt>) <strong>strip_string_values_in_array</strong>
218
+
219
+
220
+
221
+
222
+
223
+ </h3><table class="source_code">
224
+ <tr>
225
+ <td>
226
+ <pre class="lines">
227
+
228
+
229
+ 2
230
+ 3
231
+ 4
232
+ 5
233
+ 6
234
+ 7
235
+ 8</pre>
236
+ </td>
237
+ <td>
238
+ <pre class="code"><span class="info file"># File 'lib/boris/helpers/array.rb', line 2</span>
239
+
240
+ <span class='kw'>def</span> <span class='id identifier rubyid_strip_string_values_in_array'>strip_string_values_in_array</span>
241
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_map!'>map!</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_val'>val</span><span class='op'>|</span>
242
+ <span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_strip_string_values_in_array'>strip_string_values_in_array</span> <span class='kw'>if</span> <span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
243
+ <span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_strip_string_values_in_hash'>strip_string_values_in_hash</span> <span class='kw'>if</span> <span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
244
+ <span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span> <span class='op'>:</span> <span class='id identifier rubyid_val'>val</span>
245
+ <span class='kw'>end</span>
246
+ <span class='kw'>end</span></pre>
247
+ </td>
248
+ </tr>
249
+ </table>
250
+ </div>
251
+
252
+ <div class="method_details ">
253
+ <h3 class="signature " id="to_ms_product_key-instance_method">
254
+
255
+ - (<tt>Object</tt>) <strong>to_ms_product_key</strong>
256
+
257
+
258
+
259
+
260
+
261
+ </h3><table class="source_code">
262
+ <tr>
263
+ <td>
264
+ <pre class="lines">
265
+
266
+
267
+ 10
268
+ 11
269
+ 12
270
+ 13
271
+ 14
272
+ 15
273
+ 16
274
+ 17
275
+ 18
276
+ 19
277
+ 20
278
+ 21
279
+ 22
280
+ 23
281
+ 24
282
+ 25
283
+ 26
284
+ 27
285
+ 28
286
+ 29
287
+ 30
288
+ 31
289
+ 32
290
+ 33
291
+ 34
292
+ 35
293
+ 36
294
+ 37
295
+ 38</pre>
296
+ </td>
297
+ <td>
298
+ <pre class="code"><span class="info file"># File 'lib/boris/helpers/array.rb', line 10</span>
299
+
300
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_ms_product_key'>to_ms_product_key</span>
301
+ <span class='id identifier rubyid_valid_chars'>valid_chars</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>BCDFGHJKMPQRTVWXY2346789</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>.</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
302
+
303
+ <span class='id identifier rubyid_product_key'>product_key</span> <span class='op'>=</span> <span class='kw'>nil</span>
304
+
305
+ <span class='id identifier rubyid_raw_product_key'>raw_product_key</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
306
+
307
+ <span class='int'>52</span><span class='period'>.</span><span class='id identifier rubyid_upto'>upto</span><span class='lparen'>(</span><span class='int'>66</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_idx'>idx</span><span class='op'>|</span>
308
+ <span class='id identifier rubyid_raw_product_key'>raw_product_key</span> <span class='op'>&lt;&lt;</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_idx'>idx</span><span class='rbracket'>]</span>
309
+ <span class='kw'>end</span>
310
+
311
+ <span class='int'>24</span><span class='period'>.</span><span class='id identifier rubyid_downto'>downto</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='op'>|</span>
312
+ <span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='int'>0</span>
313
+
314
+ <span class='int'>14</span><span class='period'>.</span><span class='id identifier rubyid_downto'>downto</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
315
+ <span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='id identifier rubyid_b'>b</span> <span class='op'>*</span> <span class='int'>256</span> <span class='op'>^</span> <span class='id identifier rubyid_raw_product_key'>raw_product_key</span><span class='lbracket'>[</span><span class='id identifier rubyid_c'>c</span><span class='rbracket'>]</span>
316
+ <span class='id identifier rubyid_raw_product_key'>raw_product_key</span><span class='lbracket'>[</span><span class='id identifier rubyid_c'>c</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_b'>b</span> <span class='op'>/</span> <span class='int'>24</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
317
+ <span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_remainder'>remainder</span><span class='lparen'>(</span><span class='int'>24</span><span class='rparen'>)</span>
318
+ <span class='kw'>end</span>
319
+
320
+ <span class='id identifier rubyid_product_key'>product_key</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_valid_chars'>valid_chars</span><span class='lbracket'>[</span><span class='id identifier rubyid_b'>b</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_product_key'>product_key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
321
+
322
+ <span class='kw'>if</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_remainder'>remainder</span><span class='lparen'>(</span><span class='int'>5</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='int'>0</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_a'>a</span> <span class='op'>!=</span> <span class='int'>0</span>
323
+ <span class='id identifier rubyid_product_key'>product_key</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_product_key'>product_key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
324
+ <span class='kw'>end</span>
325
+ <span class='kw'>end</span>
326
+
327
+ <span class='kw'>return</span> <span class='id identifier rubyid_product_key'>product_key</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span>
328
+ <span class='kw'>end</span></pre>
329
+ </td>
330
+ </tr>
331
+ </table>
332
+ </div>
333
+
334
+ <div class="method_details ">
335
+ <h3 class="signature " id="to_nil_hash-instance_method">
336
+
337
+ - (<tt>Object</tt>) <strong>to_nil_hash</strong>
338
+
339
+
340
+
341
+
342
+
343
+ </h3><table class="source_code">
344
+ <tr>
345
+ <td>
346
+ <pre class="lines">
347
+
348
+
349
+ 40
350
+ 41
351
+ 42
352
+ 43
353
+ 44
354
+ 45
355
+ 46
356
+ 47
357
+ 48
358
+ 49
359
+ 50</pre>
360
+ </td>
361
+ <td>
362
+ <pre class="code"><span class="info file"># File 'lib/boris/helpers/array.rb', line 40</span>
363
+
364
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_nil_hash'>to_nil_hash</span>
365
+ <span class='id identifier rubyid_h'>h</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
366
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
367
+ <span class='kw'>if</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
368
+ <span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
369
+ <span class='kw'>else</span>
370
+ <span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
371
+ <span class='kw'>end</span>
372
+ <span class='kw'>end</span>
373
+ <span class='kw'>return</span> <span class='id identifier rubyid_h'>h</span>
374
+ <span class='kw'>end</span></pre>
375
+ </td>
376
+ </tr>
377
+ </table>
378
+ </div>
379
+
380
+ <div class="method_details ">
381
+ <h3 class="signature " id="to_wwn-instance_method">
382
+
383
+ - (<tt>Object</tt>) <strong>to_wwn</strong>
384
+
385
+
386
+
387
+
388
+
389
+ </h3><table class="source_code">
390
+ <tr>
391
+ <td>
392
+ <pre class="lines">
393
+
394
+
395
+ 52
396
+ 53
397
+ 54
398
+ 55
399
+ 56
400
+ 57
401
+ 58
402
+ 59
403
+ 60
404
+ 61
405
+ 62</pre>
406
+ </td>
407
+ <td>
408
+ <pre class="code"><span class="info file"># File 'lib/boris/helpers/array.rb', line 52</span>
409
+
410
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_wwn'>to_wwn</span>
411
+ <span class='id identifier rubyid_wwn'>wwn</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
412
+
413
+ <span class='int'>0</span><span class='period'>.</span><span class='id identifier rubyid_upto'>upto</span><span class='lparen'>(</span><span class='int'>7</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
414
+ <span class='id identifier rubyid_hex'>hex</span> <span class='op'>=</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='int'>16</span><span class='rparen'>)</span>
415
+ <span class='id identifier rubyid_hex'>hex</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_hex'>hex</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>&lt;</span> <span class='int'>16</span>
416
+ <span class='id identifier rubyid_wwn'>wwn</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_hex'>hex</span>
417
+ <span class='kw'>end</span>
418
+
419
+ <span class='kw'>return</span> <span class='id identifier rubyid_wwn'>wwn</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span>
420
+ <span class='kw'>end</span></pre>
421
+ </td>
422
+ </tr>
423
+ </table>
424
+ </div>
425
+
426
+ </div>
427
+
428
+ </div>
429
+
430
+ <div id="footer">
431
+ Generated on Sun Feb 3 16:32:43 2013 by
432
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
433
+ 0.8.3 (ruby-1.9.3).
434
+ </div>
435
+
436
+ </body>
437
+ </html>