blackbox 1.1.2 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +25 -0
  3. data/Gemfile +1 -0
  4. data/Guardfile +3 -2
  5. data/Makefile +1 -0
  6. data/README.md +1 -1
  7. data/Rakefile +14 -16
  8. data/blackbox.gemspec +24 -18
  9. data/coverage/.last_run.json +1 -1
  10. data/coverage/.resultset.json +136 -37
  11. data/coverage/.resultset.json.lock +0 -0
  12. data/coverage/assets/0.10.0/application.css +799 -0
  13. data/coverage/assets/0.10.0/application.js +1707 -0
  14. data/coverage/assets/0.10.0/colorbox/border.png +0 -0
  15. data/coverage/assets/0.10.0/colorbox/controls.png +0 -0
  16. data/coverage/assets/0.10.0/colorbox/loading.gif +0 -0
  17. data/coverage/assets/0.10.0/colorbox/loading_background.png +0 -0
  18. data/coverage/assets/0.10.0/favicon_green.png +0 -0
  19. data/coverage/assets/0.10.0/favicon_red.png +0 -0
  20. data/coverage/assets/0.10.0/favicon_yellow.png +0 -0
  21. data/coverage/assets/0.10.0/loading.gif +0 -0
  22. data/coverage/assets/0.10.0/magnify.png +0 -0
  23. data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  24. data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  25. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  26. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  27. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  28. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  29. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  30. data/coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  31. data/coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
  32. data/coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  33. data/coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
  34. data/coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
  35. data/coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  36. data/coverage/index.html +1153 -543
  37. data/doc/BB.html +22 -11
  38. data/doc/BB/Crypto.html +30 -34
  39. data/doc/BB/Gem.html +415 -0
  40. data/doc/BB/Hash.html +16 -16
  41. data/doc/BB/Number.html +100 -68
  42. data/doc/BB/String.html +12 -12
  43. data/doc/_index.html +22 -7
  44. data/doc/class_list.html +8 -3
  45. data/doc/css/style.css +2 -1
  46. data/doc/file.README.html +7 -7
  47. data/doc/file_list.html +7 -2
  48. data/doc/frames.html +5 -7
  49. data/doc/index.html +7 -7
  50. data/doc/js/app.js +7 -2
  51. data/doc/js/full_list.js +11 -3
  52. data/doc/method_list.html +25 -38
  53. data/doc/top-level-namespace.html +6 -6
  54. data/lib/blackbox.rb +7 -5
  55. data/lib/blackbox/crypto.rb +8 -10
  56. data/lib/blackbox/gem.rb +82 -0
  57. data/lib/blackbox/hash.rb +5 -5
  58. data/lib/blackbox/number.rb +127 -110
  59. data/lib/blackbox/string.rb +5 -5
  60. data/lib/blackbox/version.rb +2 -1
  61. data/spec/blackbox_spec.rb +1 -1
  62. data/spec/crypto_spec.rb +23 -23
  63. data/spec/gem_spec.rb +48 -0
  64. data/spec/hash_spec.rb +26 -26
  65. data/spec/number_spec.rb +95 -44
  66. data/spec/spec_helper.rb +2 -1
  67. data/spec/string_spec.rb +3 -3
  68. metadata +76 -4
data/doc/class_list.html CHANGED
@@ -15,11 +15,16 @@
15
15
  <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
16
 
17
17
 
18
+ <title>Class List</title>
18
19
  <base id="base_target" target="_parent" />
19
20
  </head>
20
21
  <body>
21
22
  <script type="text/javascript" charset="utf-8">
22
- if (window.top.frames.main) {
23
+ var hasFrames = false;
24
+ try {
25
+ hasFrames = window.top.frames.main ? true : false;
26
+ } catch (e) { }
27
+ if (hasFrames) {
23
28
  document.getElementById('base_target').target = 'main';
24
29
  document.body.className = 'frames';
25
30
  }
@@ -44,8 +49,8 @@
44
49
  <div id="search">Search: <input type="text" /></div>
45
50
 
46
51
  <ul id="full_list" class="class">
47
- <li><span class='object_link'><a href="top-level-namespace.html" title=" (root)">Top Level Namespace</a></span></li>
48
- <li><a class='toggle'></a> <span class='object_link'><a href="BB.html" title="BB (module)">BB</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="BB/Crypto.html" title="BB::Crypto (module)">Crypto</a></span><small class='search_info'>BB</small></li><li><span class='object_link'><a href="BB/Hash.html" title="BB::Hash (module)">Hash</a></span><small class='search_info'>BB</small></li><li><span class='object_link'><a href="BB/Number.html" title="BB::Number (module)">Number</a></span><small class='search_info'>BB</small></li><li><span class='object_link'><a href="BB/String.html" title="BB::String (module)">String</a></span><small class='search_info'>BB</small></li></ul>
52
+ <li><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></li>
53
+ <li><a class='toggle'></a> <span class='object_link'><a href="BB.html" title="BB (module)">BB</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="BB/Crypto.html" title="BB::Crypto (module)">Crypto</a></span><small class='search_info'>BB</small></li><li><span class='object_link'><a href="BB/Gem.html" title="BB::Gem (module)">Gem</a></span><small class='search_info'>BB</small></li><li><span class='object_link'><a href="BB/Hash.html" title="BB::Hash (module)">Hash</a></span><small class='search_info'>BB</small></li><li><span class='object_link'><a href="BB/Number.html" title="BB::Number (module)">Number</a></span><small class='search_info'>BB</small></li><li><span class='object_link'><a href="BB/String.html" title="BB::String (module)">String</a></span><small class='search_info'>BB</small></li></ul>
49
54
 
50
55
  </ul>
51
56
  </div>
data/doc/css/style.css CHANGED
@@ -291,6 +291,7 @@ li.r2 { background: #fafafa; }
291
291
  -moz-box-shadow: -2px 2px 6px #bbb;
292
292
  z-index: 5000;
293
293
  position: relative;
294
+ overflow-x: auto;
294
295
  }
295
296
  #toc.nofloat { float: none; max-width: none; border: none; padding: 0; margin: 20px 0; -webkit-box-shadow: none; -moz-box-shadow: none; }
296
297
  #toc.nofloat.hidden { padding: 0; background: 0; margin-bottom: 5px; }
@@ -324,9 +325,9 @@ pre.code .dot + pre.code .id,
324
325
  pre.code .rubyid_to_i pre.code .rubyid_each { color: #0085FF; }
325
326
  pre.code .comment { color: #0066FF; }
326
327
  pre.code .const, pre.code .constant { color: #585CF6; }
328
+ pre.code .label,
327
329
  pre.code .symbol { color: #C5060B; }
328
330
  pre.code .kw,
329
- pre.code .label,
330
331
  pre.code .rubyid_require,
331
332
  pre.code .rubyid_extend,
332
333
  pre.code .rubyid_include { color: #0000FF; }
data/doc/file.README.html CHANGED
@@ -6,18 +6,18 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.5.2
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
13
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
14
 
15
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
16
 
17
17
  <script type="text/javascript" charset="utf-8">
18
18
  hasFrames = window.top.frames.main ? true : false;
19
19
  relpath = '';
20
- framesUrl = "frames.html#!" + escape(window.location.href);
20
+ framesUrl = "frames.html#!file.README.html";
21
21
  </script>
22
22
 
23
23
 
@@ -61,7 +61,7 @@
61
61
 
62
62
  <iframe id="search_frame"></iframe>
63
63
 
64
- <div id="content"><div id='filecontents'><h1>Blackbox <a href="https://travis-ci.org/busyloop/blackbox"><img src="https://travis-ci.org/busyloop/blackbox.png?branch=master" alt="Build Status"></a></h1>
64
+ <div id="content"><div id='filecontents'><h1>Blackbox <a href="https://travis-ci.org/busyloop/blackbox"><img src="https://travis-ci.org/busyloop/blackbox.png?branch=master" alt="Build Status"></a> <a href="https://gemnasium.com/github.com/busyloop/blackbox"><img src="https://gemnasium.com/badges/github.com/busyloop/blackbox.svg" alt="Dependency Status"></a></h1>
65
65
 
66
66
  <p>Various little helpers.</p>
67
67
 
@@ -95,9 +95,9 @@ BB::String.strip_ansi( ... )
95
95
  </div></div>
96
96
 
97
97
  <div id="footer">
98
- Generated on Sun Nov 22 18:39:44 2015 by
98
+ Generated on Sat May 14 21:21:15 2016 by
99
99
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
100
- 0.8.5.2 (ruby-2.2.2).
100
+ 0.8.7.6 (ruby-2.3.0).
101
101
  </div>
102
102
 
103
103
  </body>
data/doc/file_list.html CHANGED
@@ -15,11 +15,16 @@
15
15
  <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
16
 
17
17
 
18
+ <title>File List</title>
18
19
  <base id="base_target" target="_parent" />
19
20
  </head>
20
21
  <body>
21
22
  <script type="text/javascript" charset="utf-8">
22
- if (window.top.frames.main) {
23
+ var hasFrames = false;
24
+ try {
25
+ hasFrames = window.top.frames.main ? true : false;
26
+ } catch (e) { }
27
+ if (hasFrames) {
23
28
  document.getElementById('base_target').target = 'main';
24
29
  document.body.className = 'frames';
25
30
  }
@@ -46,7 +51,7 @@
46
51
  <ul id="full_list" class="file">
47
52
 
48
53
 
49
- <li class="r1"><a href="index.html" title="README">README</a></li>
54
+ <li class="r1"><span class="object_link"><a href="index.html" title="README">README</a></a></li>
50
55
 
51
56
 
52
57
  </ul>
data/doc/frames.html CHANGED
@@ -4,18 +4,16 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
5
  <head>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>Documentation by YARD 0.8.5.2</title>
7
+ <title>Documentation by YARD 0.8.7.6</title>
8
8
  </head>
9
9
  <script type="text/javascript" charset="utf-8">
10
10
  window.onload = function() {
11
- var match = window.location.hash.match(/^#!(.+)/);
12
- var name = 'index.html';
13
- if (match) {
14
- name = unescape(match[1]);
15
- }
11
+ var match = unescape(window.location.hash).match(/^#!(.+)/);
12
+ var name = match ? match[1] : 'index.html';
13
+ name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
16
14
  document.writeln('<frameset cols="20%,*">' +
17
15
  '<frame name="list" src="class_list.html" />' +
18
- '<frame name="main" src="' + name + '" />' +
16
+ '<frame name="main" src="' + escape(name) + '" />' +
19
17
  '</frameset>');
20
18
  }
21
19
  </script>
data/doc/index.html CHANGED
@@ -6,18 +6,18 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.5.2
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
13
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
14
 
15
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
16
 
17
17
  <script type="text/javascript" charset="utf-8">
18
18
  hasFrames = window.top.frames.main ? true : false;
19
19
  relpath = '';
20
- framesUrl = "frames.html#!" + escape(window.location.href);
20
+ framesUrl = "frames.html#!file.README.html";
21
21
  </script>
22
22
 
23
23
 
@@ -61,7 +61,7 @@
61
61
 
62
62
  <iframe id="search_frame"></iframe>
63
63
 
64
- <div id="content"><div id='filecontents'><h1>Blackbox <a href="https://travis-ci.org/busyloop/blackbox"><img src="https://travis-ci.org/busyloop/blackbox.png?branch=master" alt="Build Status"></a></h1>
64
+ <div id="content"><div id='filecontents'><h1>Blackbox <a href="https://travis-ci.org/busyloop/blackbox"><img src="https://travis-ci.org/busyloop/blackbox.png?branch=master" alt="Build Status"></a> <a href="https://gemnasium.com/github.com/busyloop/blackbox"><img src="https://gemnasium.com/badges/github.com/busyloop/blackbox.svg" alt="Dependency Status"></a></h1>
65
65
 
66
66
  <p>Various little helpers.</p>
67
67
 
@@ -95,9 +95,9 @@ BB::String.strip_ansi( ... )
95
95
  </div></div>
96
96
 
97
97
  <div id="footer">
98
- Generated on Sun Nov 22 18:39:44 2015 by
98
+ Generated on Sat May 14 21:21:15 2016 by
99
99
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
100
- 0.8.5.2 (ruby-2.2.2).
100
+ 0.8.7.6 (ruby-2.3.0).
101
101
  </div>
102
102
 
103
103
  </body>
data/doc/js/app.js CHANGED
@@ -78,7 +78,12 @@ function framesInit() {
78
78
  if (hasFrames) {
79
79
  document.body.className = 'frames';
80
80
  $('#menu .noframes a').attr('href', document.location);
81
- window.top.document.title = $('html head title').text();
81
+ try {
82
+ window.top.document.title = $('html head title').text();
83
+ } catch(error) {
84
+ // some browsers will not allow this when serving from file://
85
+ // but we don't want to stop the world.
86
+ }
82
87
  }
83
88
  else {
84
89
  $('#menu .noframes a').text('frames').attr('href', framesUrl);
@@ -211,4 +216,4 @@ $(linkSummaries);
211
216
  $(keyboardShortcuts);
212
217
  $(summaryToggle);
213
218
  $(fixOutsideWorldLinks);
214
- $(generateTOC);
219
+ $(generateTOC);
data/doc/js/full_list.js CHANGED
@@ -17,6 +17,7 @@ function fullListSearch() {
17
17
  searchCache = [];
18
18
  $('#full_list li').each(function() {
19
19
  var link = $(this).find('.object_link a');
20
+ if (link.length === 0) return;
20
21
  var fullName = link.attr('title').split(' ')[0];
21
22
  searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link});
22
23
  });
@@ -41,7 +42,7 @@ function fullListSearch() {
41
42
  $('#full_list li').removeClass('found').each(function() {
42
43
 
43
44
  var link = $(this).find('.object_link a');
44
- link.text(link.text());
45
+ if (link.length > 0) link.text(link.text());
45
46
  });
46
47
  if (clicked) {
47
48
  clicked.parents('ul').each(function() {
@@ -111,6 +112,10 @@ function linkList() {
111
112
  $('#full_list li, #full_list li a:last').click(function(evt) {
112
113
  if ($(this).hasClass('toggle')) return true;
113
114
  if (this.tagName.toLowerCase() == "li") {
115
+ if ($(this).find('.object_link a').length === 0) {
116
+ $(this).children('a.toggle').click();
117
+ return false;
118
+ }
114
119
  var toggle = $(this).children('a.toggle');
115
120
  if (toggle.size() > 0 && evt.pageX < toggle.offset().left) {
116
121
  toggle.click();
@@ -118,9 +123,12 @@ function linkList() {
118
123
  }
119
124
  }
120
125
  if (clicked) clicked.removeClass('clicked');
121
- var win = window.top.frames.main ? window.top.frames.main : window.parent;
126
+ var win;
127
+ try {
128
+ win = window.top.frames.main ? window.top.frames.main : window.parent;
129
+ } catch (e) { win = window.parent; }
122
130
  if (this.tagName.toLowerCase() == "a") {
123
- clicked = $(this).parent('li').addClass('clicked');
131
+ clicked = $(this).parents('li').addClass('clicked');
124
132
  win.location = this.href;
125
133
  }
126
134
  else {
data/doc/method_list.html CHANGED
@@ -15,11 +15,16 @@
15
15
  <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
16
 
17
17
 
18
+ <title>Method List</title>
18
19
  <base id="base_target" target="_parent" />
19
20
  </head>
20
21
  <body>
21
22
  <script type="text/javascript" charset="utf-8">
22
- if (window.top.frames.main) {
23
+ var hasFrames = false;
24
+ try {
25
+ hasFrames = window.top.frames.main ? true : false;
26
+ } catch (e) { }
27
+ if (hasFrames) {
23
28
  document.getElementById('base_target').target = 'main';
24
29
  document.body.className = 'frames';
25
30
  }
@@ -48,97 +53,79 @@
48
53
 
49
54
  <li class="r1 ">
50
55
  <span class='object_link'><a href="BB/Crypto.html#decrypt-class_method" title="BB::Crypto.decrypt (method)">decrypt</a></span>
51
-
52
- <small>BB::Crypto</small>
53
-
56
+ <small>BB::Crypto</small>
54
57
  </li>
55
58
 
56
59
 
57
60
  <li class="r2 ">
58
61
  <span class='object_link'><a href="BB/Crypto.html#decrypt_base64-class_method" title="BB::Crypto.decrypt_base64 (method)">decrypt_base64</a></span>
59
-
60
- <small>BB::Crypto</small>
61
-
62
+ <small>BB::Crypto</small>
62
63
  </li>
63
64
 
64
65
 
65
66
  <li class="r1 ">
66
67
  <span class='object_link'><a href="BB/Crypto.html#decrypt_urlsafe_base64-class_method" title="BB::Crypto.decrypt_urlsafe_base64 (method)">decrypt_urlsafe_base64</a></span>
67
-
68
- <small>BB::Crypto</small>
69
-
68
+ <small>BB::Crypto</small>
70
69
  </li>
71
70
 
72
71
 
73
72
  <li class="r2 ">
74
73
  <span class='object_link'><a href="BB/Crypto.html#encrypt-class_method" title="BB::Crypto.encrypt (method)">encrypt</a></span>
75
-
76
- <small>BB::Crypto</small>
77
-
74
+ <small>BB::Crypto</small>
78
75
  </li>
79
76
 
80
77
 
81
78
  <li class="r1 ">
82
79
  <span class='object_link'><a href="BB/Crypto.html#encrypt_base64-class_method" title="BB::Crypto.encrypt_base64 (method)">encrypt_base64</a></span>
83
-
84
- <small>BB::Crypto</small>
85
-
80
+ <small>BB::Crypto</small>
86
81
  </li>
87
82
 
88
83
 
89
84
  <li class="r2 ">
90
85
  <span class='object_link'><a href="BB/Crypto.html#encrypt_urlsafe_base64-class_method" title="BB::Crypto.encrypt_urlsafe_base64 (method)">encrypt_urlsafe_base64</a></span>
91
-
92
- <small>BB::Crypto</small>
93
-
86
+ <small>BB::Crypto</small>
94
87
  </li>
95
88
 
96
89
 
97
90
  <li class="r1 ">
98
91
  <span class='object_link'><a href="BB/Hash.html#flatten_prop_style-class_method" title="BB::Hash.flatten_prop_style (method)">flatten_prop_style</a></span>
99
-
100
- <small>BB::Hash</small>
101
-
92
+ <small>BB::Hash</small>
102
93
  </li>
103
94
 
104
95
 
105
96
  <li class="r2 ">
106
97
  <span class='object_link'><a href="BB/String.html#strip_ansi-class_method" title="BB::String.strip_ansi (method)">strip_ansi</a></span>
107
-
108
- <small>BB::String</small>
109
-
98
+ <small>BB::String</small>
110
99
  </li>
111
100
 
112
101
 
113
102
  <li class="r1 ">
114
103
  <span class='object_link'><a href="BB/Hash.html#symbolize_keys-class_method" title="BB::Hash.symbolize_keys (method)">symbolize_keys</a></span>
115
-
116
- <small>BB::Hash</small>
117
-
104
+ <small>BB::Hash</small>
118
105
  </li>
119
106
 
120
107
 
121
108
  <li class="r2 ">
122
109
  <span class='object_link'><a href="BB/Number.html#to_human_size-class_method" title="BB::Number.to_human_size (method)">to_human_size</a></span>
123
-
124
- <small>BB::Number</small>
125
-
110
+ <small>BB::Number</small>
126
111
  </li>
127
112
 
128
113
 
129
114
  <li class="r1 ">
130
- <span class='object_link'><a href="BB/Number.html#with_delimiter-class_method" title="BB::Number.with_delimiter (method)">with_delimiter</a></span>
131
-
132
- <small>BB::Number</small>
133
-
115
+ <span class='object_link'><a href="BB/Gem.html#version_info-class_method" title="BB::Gem.version_info (method)">version_info</a></span>
116
+ <small>BB::Gem</small>
134
117
  </li>
135
118
 
136
119
 
137
120
  <li class="r2 ">
121
+ <span class='object_link'><a href="BB/Number.html#with_delimiter-class_method" title="BB::Number.with_delimiter (method)">with_delimiter</a></span>
122
+ <small>BB::Number</small>
123
+ </li>
124
+
125
+
126
+ <li class="r1 ">
138
127
  <span class='object_link'><a href="BB/Number.html#with_precision-class_method" title="BB::Number.with_precision (method)">with_precision</a></span>
139
-
140
- <small>BB::Number</small>
141
-
128
+ <small>BB::Number</small>
142
129
  </li>
143
130
 
144
131
 
@@ -6,18 +6,18 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Documentation by YARD 0.8.5.2
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
13
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
14
 
15
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
16
 
17
17
  <script type="text/javascript" charset="utf-8">
18
18
  hasFrames = window.top.frames.main ? true : false;
19
19
  relpath = '';
20
- framesUrl = "frames.html#!" + escape(window.location.href);
20
+ framesUrl = "frames.html#!top-level-namespace.html";
21
21
  </script>
22
22
 
23
23
 
@@ -103,9 +103,9 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sun Nov 22 18:39:44 2015 by
106
+ Generated on Sat May 14 21:21:15 2016 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
- 0.8.5.2 (ruby-2.2.2).
108
+ 0.8.7.6 (ruby-2.3.0).
109
109
  </div>
110
110
 
111
111
  </body>
data/lib/blackbox.rb CHANGED
@@ -1,5 +1,7 @@
1
- require "blackbox/version"
2
- require "blackbox/crypto"
3
- require "blackbox/string"
4
- require "blackbox/hash"
5
- require "blackbox/number"
1
+ # frozen_string_literal: true
2
+ require 'blackbox/version'
3
+ require 'blackbox/crypto'
4
+ require 'blackbox/string'
5
+ require 'blackbox/hash'
6
+ require 'blackbox/number'
7
+ require 'blackbox/gem'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'openssl'
2
3
  require 'base64'
3
4
 
@@ -13,7 +14,7 @@ module BB
13
14
  # @param [String] iv Initialization vector
14
15
  # @return [String] When iv == nil: iv_length+iv+ciphertext
15
16
  # @return [String] When iv != nil: ciphertext
16
- def encrypt(plaintext, key, cipher_type='aes-256-cbc', iv=nil)
17
+ def encrypt(plaintext, key, cipher_type = 'aes-256-cbc', iv = nil)
17
18
  cipher = OpenSSL::Cipher::Cipher.new(cipher_type)
18
19
  cipher.encrypt
19
20
  cipher.key = key
@@ -33,15 +34,13 @@ module BB
33
34
  # @param [String] cipher_type OpenSSL cipher
34
35
  # @param [String] iv Initialization vector
35
36
  # @return [String] Plaintext
36
- def decrypt(ciphertext, key, cipher_type='aes-256-cbc', iv=nil)
37
+ def decrypt(ciphertext, key, cipher_type = 'aes-256-cbc', iv = nil)
37
38
  cipher = OpenSSL::Cipher::Cipher.new(cipher_type)
38
39
  cipher.decrypt
39
40
  cipher.key = key
40
41
  if iv.nil?
41
42
  iv_len = ciphertext.slice!(0).unpack('C')[0]
42
- unless 0 == iv_len
43
- cipher.iv = ciphertext.slice!(0..iv_len-1)
44
- end
43
+ cipher.iv = ciphertext.slice!(0..iv_len - 1) unless 0 == iv_len
45
44
  else
46
45
  cipher.iv = iv
47
46
  end
@@ -56,7 +55,7 @@ module BB
56
55
  # @param [String] iv Initialization vector
57
56
  # @return [String] When iv == nil: base64(iv_length+iv+ciphertext)
58
57
  # @return [String] When iv != nil: base64(ciphertext)
59
- def encrypt_base64(plaintext, key, cipher_type='aes-256-cbc', iv=nil)
58
+ def encrypt_base64(plaintext, key, cipher_type = 'aes-256-cbc', iv = nil)
60
59
  Base64.strict_encode64(encrypt(plaintext, key, cipher_type, iv))
61
60
  end
62
61
 
@@ -67,7 +66,7 @@ module BB
67
66
  # @param [String] cipher_type OpenSSL cipher
68
67
  # @param [String] iv Initialization vector
69
68
  # @return [String] Plaintext
70
- def decrypt_base64(ciphertext, key, cipher_type='aes-256-cbc', iv=nil)
69
+ def decrypt_base64(ciphertext, key, cipher_type = 'aes-256-cbc', iv = nil)
71
70
  decrypt(Base64.decode64(ciphertext), key, cipher_type, iv)
72
71
  end
73
72
 
@@ -79,7 +78,7 @@ module BB
79
78
  # @param [String] iv Initialization vector
80
79
  # @return [String] When iv == nil: urlsafe_base64(iv_length+iv+ciphertext)
81
80
  # @return [String] When iv != nil: urlsafe_base64(ciphertext)
82
- def encrypt_urlsafe_base64(plaintext, key, cipher_type='aes-256-cbc', iv=nil)
81
+ def encrypt_urlsafe_base64(plaintext, key, cipher_type = 'aes-256-cbc', iv = nil)
83
82
  Base64.urlsafe_encode64(encrypt(plaintext, key, cipher_type, iv))
84
83
  end
85
84
 
@@ -90,10 +89,9 @@ module BB
90
89
  # @param [String] cipher_type OpenSSL cipher
91
90
  # @param [String] iv Initialization vector
92
91
  # @return [String] Plaintext
93
- def decrypt_urlsafe_base64(ciphertext, key, cipher_type='aes-256-cbc', iv=nil)
92
+ def decrypt_urlsafe_base64(ciphertext, key, cipher_type = 'aes-256-cbc', iv = nil)
94
93
  decrypt(Base64.urlsafe_decode64(ciphertext), key, cipher_type, iv)
95
94
  end
96
95
  end
97
96
  end
98
97
  end
99
-