structured_warnings 0.2.0 → 0.3.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 (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +200 -0
  3. data/lib/{structured_warnings/dynamic.rb → dynamic.rb} +0 -0
  4. data/lib/structured_warnings.rb +19 -9
  5. data/lib/structured_warnings/base.rb +132 -0
  6. data/lib/structured_warnings/kernel.rb +5 -65
  7. data/lib/structured_warnings/minitest.rb +5 -0
  8. data/lib/structured_warnings/test.rb +3 -5
  9. data/lib/structured_warnings/test/assertions.rb +93 -98
  10. data/lib/structured_warnings/test/warner.rb +32 -35
  11. data/lib/structured_warnings/test_unit.rb +5 -0
  12. data/lib/structured_warnings/version.rb +3 -0
  13. data/lib/structured_warnings/warner.rb +13 -11
  14. data/lib/structured_warnings/warning.rb +61 -119
  15. data/lib/warning.rb +9 -0
  16. metadata +53 -92
  17. data/Gemfile +0 -3
  18. data/Gemfile.lock +0 -21
  19. data/History.txt +0 -36
  20. data/License.txt +0 -20
  21. data/README.rdoc +0 -137
  22. data/Rakefile +0 -55
  23. data/doc/DeprecatedMethodWarning.html +0 -105
  24. data/doc/DeprecatedSignatureWarning.html +0 -106
  25. data/doc/DeprecationWarning.html +0 -106
  26. data/doc/Dynamic.html +0 -125
  27. data/doc/Object.html +0 -117
  28. data/doc/README_rdoc.html +0 -283
  29. data/doc/StandardWarning.html +0 -104
  30. data/doc/StructuredWarnings.html +0 -125
  31. data/doc/StructuredWarnings/ClassMethods.html +0 -192
  32. data/doc/StructuredWarnings/Kernel.html +0 -222
  33. data/doc/StructuredWarnings/Test.html +0 -97
  34. data/doc/StructuredWarnings/Test/Assertions.html +0 -272
  35. data/doc/StructuredWarnings/Test/Warner.html +0 -208
  36. data/doc/StructuredWarnings/Warner.html +0 -162
  37. data/doc/Test.html +0 -95
  38. data/doc/Test/Unit.html +0 -95
  39. data/doc/Warning.html +0 -398
  40. data/doc/Warning/ClassMethods.html +0 -278
  41. data/doc/created.rid +0 -10
  42. data/doc/css/fonts.css +0 -167
  43. data/doc/css/rdoc.css +0 -590
  44. data/doc/fonts/Lato-Light.ttf +0 -0
  45. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  46. data/doc/fonts/Lato-Regular.ttf +0 -0
  47. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  48. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  49. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  50. data/doc/images/add.png +0 -0
  51. data/doc/images/arrow_up.png +0 -0
  52. data/doc/images/brick.png +0 -0
  53. data/doc/images/brick_link.png +0 -0
  54. data/doc/images/bug.png +0 -0
  55. data/doc/images/bullet_black.png +0 -0
  56. data/doc/images/bullet_toggle_minus.png +0 -0
  57. data/doc/images/bullet_toggle_plus.png +0 -0
  58. data/doc/images/date.png +0 -0
  59. data/doc/images/delete.png +0 -0
  60. data/doc/images/find.png +0 -0
  61. data/doc/images/loadingAnimation.gif +0 -0
  62. data/doc/images/macFFBgHack.png +0 -0
  63. data/doc/images/package.png +0 -0
  64. data/doc/images/page_green.png +0 -0
  65. data/doc/images/page_white_text.png +0 -0
  66. data/doc/images/page_white_width.png +0 -0
  67. data/doc/images/plugin.png +0 -0
  68. data/doc/images/ruby.png +0 -0
  69. data/doc/images/tag_blue.png +0 -0
  70. data/doc/images/tag_green.png +0 -0
  71. data/doc/images/transparent.png +0 -0
  72. data/doc/images/wrench.png +0 -0
  73. data/doc/images/wrench_orange.png +0 -0
  74. data/doc/images/zoom.png +0 -0
  75. data/doc/index.html +0 -121
  76. data/doc/js/darkfish.js +0 -161
  77. data/doc/js/jquery.js +0 -4
  78. data/doc/js/navigation.js +0 -142
  79. data/doc/js/navigation.js.gz +0 -0
  80. data/doc/js/search.js +0 -109
  81. data/doc/js/search_index.js +0 -1
  82. data/doc/js/search_index.js.gz +0 -0
  83. data/doc/js/searcher.js +0 -228
  84. data/doc/js/searcher.js.gz +0 -0
  85. data/doc/table_of_contents.html +0 -200
  86. data/structured_warnings.gemspec +0 -24
  87. data/test/structured_warnings_test.rb +0 -187
@@ -1,192 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>module StructuredWarnings::ClassMethods - structured_warnings</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- </script>
12
-
13
- <script src="../js/jquery.js"></script>
14
- <script src="../js/darkfish.js"></script>
15
-
16
- <link href="../css/fonts.css" rel="stylesheet">
17
- <link href="../css/rdoc.css" rel="stylesheet">
18
-
19
-
20
-
21
- <body id="top" role="document" class="module">
22
- <nav role="navigation">
23
- <div id="project-navigation">
24
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
- <h2>
26
- <a href="../index.html" rel="home">Home</a>
27
- </h2>
28
-
29
- <div id="table-of-contents-navigation">
30
- <a href="../table_of_contents.html#pages">Pages</a>
31
- <a href="../table_of_contents.html#classes">Classes</a>
32
- <a href="../table_of_contents.html#methods">Methods</a>
33
- </div>
34
- </div>
35
-
36
- <div id="search-section" role="search" class="project-section initially-hidden">
37
- <form action="#" method="get" accept-charset="utf-8">
38
- <div id="search-field-wrapper">
39
- <input id="search-field" role="combobox" aria-label="Search"
40
- aria-autocomplete="list" aria-controls="search-results"
41
- type="text" name="search" placeholder="Search" spellcheck="false"
42
- title="Type to search, Up and Down to navigate, Enter to load">
43
- </div>
44
-
45
- <ul id="search-results" aria-label="Search Results"
46
- aria-busy="false" aria-expanded="false"
47
- aria-atomic="false" class="initially-hidden"></ul>
48
- </form>
49
- </div>
50
-
51
- </div>
52
-
53
-
54
-
55
- <div id="class-metadata">
56
-
57
-
58
-
59
-
60
- <!-- Method Quickref -->
61
- <div id="method-list-section" class="nav-section">
62
- <h3>Methods</h3>
63
-
64
- <ul class="link-list" role="directory">
65
-
66
- <li ><a href="#method-i-warner">#warner</a>
67
-
68
- <li ><a href="#method-i-with_warner">#with_warner</a>
69
-
70
- </ul>
71
- </div>
72
-
73
- </div>
74
- </nav>
75
-
76
- <main role="main" aria-labelledby="module-StructuredWarnings::ClassMethods">
77
- <h1 id="module-StructuredWarnings::ClassMethods" class="module">
78
- module StructuredWarnings::ClassMethods
79
- </h1>
80
-
81
- <section class="description">
82
-
83
- <p>If you <code>require &quot;test/unit&quot;</code> after
84
- <code>structured_warnings</code> you have to <code>require
85
- &quot;structured_warnings/test&quot;</code> manually, otherwise the test
86
- extensions will be added automatically.</p>
87
-
88
- </section>
89
-
90
-
91
-
92
-
93
- <section id="5Buntitled-5D" class="documentation-section">
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
104
- <header>
105
- <h3>Public Instance Methods</h3>
106
- </header>
107
-
108
-
109
- <div id="method-i-warner" class="method-detail ">
110
-
111
- <div class="method-heading">
112
- <span class="method-name">warner</span><span
113
- class="method-args">()</span>
114
-
115
- <span class="method-click-advice">click to toggle source</span>
116
-
117
- </div>
118
-
119
-
120
- <div class="method-description">
121
-
122
- <p>Gives access to the currently used warner. Default is an instance of <a
123
- href="Warner.html">StructuredWarnings::Warner</a></p>
124
-
125
-
126
-
127
-
128
- <div class="method-source-code" id="warner-source">
129
- <pre><span class="ruby-comment"># File lib/structured_warnings.rb, line 23</span>
130
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">warner</span>
131
- <span class="ruby-constant">Dynamic</span>[<span class="ruby-value">:warner</span>]
132
- <span class="ruby-keyword">end</span></pre>
133
- </div>
134
-
135
- </div>
136
-
137
-
138
-
139
-
140
- </div>
141
-
142
-
143
- <div id="method-i-with_warner" class="method-detail ">
144
-
145
- <div class="method-heading">
146
- <span class="method-name">with_warner</span><span
147
- class="method-args">(warner) { || ... }</span>
148
-
149
- <span class="method-click-advice">click to toggle source</span>
150
-
151
- </div>
152
-
153
-
154
- <div class="method-description">
155
-
156
- <p>Executes a block using the given warner. This may be used to suppress
157
- warnings to stdout, but fetch them and redirect them to somewhere else.</p>
158
-
159
- <p>This behaviour is used in the StructuredWarnings::Assertions</p>
160
-
161
-
162
-
163
-
164
- <div class="method-source-code" id="with_warner-source">
165
- <pre><span class="ruby-comment"># File lib/structured_warnings.rb, line 15</span>
166
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">with_warner</span>(<span class="ruby-identifier">warner</span>)
167
- <span class="ruby-constant">Dynamic</span>.<span class="ruby-identifier">let</span>(<span class="ruby-value">:warner</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">warner</span>) <span class="ruby-keyword">do</span>
168
- <span class="ruby-keyword">yield</span>
169
- <span class="ruby-keyword">end</span>
170
- <span class="ruby-keyword">end</span></pre>
171
- </div>
172
-
173
- </div>
174
-
175
-
176
-
177
-
178
- </div>
179
-
180
-
181
- </section>
182
-
183
- </section>
184
- </main>
185
-
186
-
187
- <footer id="validator-badges" role="contentinfo">
188
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
189
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
190
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
191
- </footer>
192
-
@@ -1,222 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>module StructuredWarnings::Kernel - structured_warnings</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- </script>
12
-
13
- <script src="../js/jquery.js"></script>
14
- <script src="../js/darkfish.js"></script>
15
-
16
- <link href="../css/fonts.css" rel="stylesheet">
17
- <link href="../css/rdoc.css" rel="stylesheet">
18
-
19
-
20
-
21
- <body id="top" role="document" class="module">
22
- <nav role="navigation">
23
- <div id="project-navigation">
24
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
- <h2>
26
- <a href="../index.html" rel="home">Home</a>
27
- </h2>
28
-
29
- <div id="table-of-contents-navigation">
30
- <a href="../table_of_contents.html#pages">Pages</a>
31
- <a href="../table_of_contents.html#classes">Classes</a>
32
- <a href="../table_of_contents.html#methods">Methods</a>
33
- </div>
34
- </div>
35
-
36
- <div id="search-section" role="search" class="project-section initially-hidden">
37
- <form action="#" method="get" accept-charset="utf-8">
38
- <div id="search-field-wrapper">
39
- <input id="search-field" role="combobox" aria-label="Search"
40
- aria-autocomplete="list" aria-controls="search-results"
41
- type="text" name="search" placeholder="Search" spellcheck="false"
42
- title="Type to search, Up and Down to navigate, Enter to load">
43
- </div>
44
-
45
- <ul id="search-results" aria-label="Search Results"
46
- aria-busy="false" aria-expanded="false"
47
- aria-atomic="false" class="initially-hidden"></ul>
48
- </form>
49
- </div>
50
-
51
- </div>
52
-
53
-
54
-
55
- <div id="class-metadata">
56
-
57
-
58
-
59
-
60
- <!-- Method Quickref -->
61
- <div id="method-list-section" class="nav-section">
62
- <h3>Methods</h3>
63
-
64
- <ul class="link-list" role="directory">
65
-
66
- <li class="calls-super" ><a href="#method-i-warn">#warn</a>
67
-
68
- </ul>
69
- </div>
70
-
71
- </div>
72
- </nav>
73
-
74
- <main role="main" aria-labelledby="module-StructuredWarnings::Kernel">
75
- <h1 id="module-StructuredWarnings::Kernel" class="module">
76
- module StructuredWarnings::Kernel
77
- </h1>
78
-
79
- <section class="description">
80
-
81
- <p>This module encapsulates the extensions to <a
82
- href="../Object.html">Object</a>, that are introduced by this library.</p>
83
-
84
- </section>
85
-
86
-
87
-
88
-
89
- <section id="5Buntitled-5D" class="documentation-section">
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
100
- <header>
101
- <h3>Public Instance Methods</h3>
102
- </header>
103
-
104
-
105
- <div id="method-i-warn" class="method-detail ">
106
-
107
-
108
- <div class="method-heading">
109
- <span class="method-callseq">
110
- warn(message = nil)
111
- </span>
112
-
113
- <span class="method-click-advice">click to toggle source</span>
114
-
115
- </div>
116
-
117
- <div class="method-heading">
118
- <span class="method-callseq">
119
- warn(warning_class, message)
120
- </span>
121
-
122
- </div>
123
-
124
- <div class="method-heading">
125
- <span class="method-callseq">
126
- warn(warning_instance)
127
- </span>
128
-
129
- </div>
130
-
131
-
132
-
133
- <div class="method-description">
134
-
135
- <p>This method provides a <code>raise</code>-like interface. It extends the
136
- default warn in ::Kernel to allow the use of structured warnings.</p>
137
-
138
- <p>Internally it uses the StructuredWarnings::warner to format a message based
139
- on the given warning class, the message and a stack frame. The return value
140
- is passed to super, which is likely the implementation in ::Kernel. That
141
- way, it is less likely, that structured_warnings interferes with other
142
- extensions.</p>
143
-
144
- <p>It the warner return nil or an empty string the underlying warn will not be
145
- called. That way, warnings may be transferred to other devices without the
146
- need to redefine ::Kernel#warn.</p>
147
-
148
- <p>Just like the original version, this method does not take command line
149
- switches or verbosity levels into account. In order to deactivate all
150
- warnings use <code>Warning.disable</code>.</p>
151
-
152
- <pre class="ruby"><span class="ruby-identifier">warn</span> <span class="ruby-string">&quot;This is an old-style warning&quot;</span> <span class="ruby-comment"># This will emit a StandardWarning</span>
153
-
154
- <span class="ruby-keyword">class</span> <span class="ruby-constant">Foo</span>
155
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">bar</span>
156
- <span class="ruby-identifier">warn</span> <span class="ruby-constant">DeprecationWarning</span>, <span class="ruby-string">&quot;Never use bar again, use beer&quot;</span>
157
- <span class="ruby-keyword">end</span>
158
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">beer</span>
159
- <span class="ruby-string">&quot;Ahhh&quot;</span>
160
- <span class="ruby-keyword">end</span>
161
- <span class="ruby-keyword">end</span>
162
-
163
- <span class="ruby-identifier">warn</span> <span class="ruby-constant">Warning</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;The least specific warning you can get&quot;</span>)
164
- </pre>
165
-
166
-
167
- <div class="method-calls-super">
168
- Calls superclass method
169
-
170
- </div>
171
-
172
-
173
-
174
- <div class="method-source-code" id="warn-source">
175
- <pre><span class="ruby-comment"># File lib/structured_warnings/kernel.rb, line 41</span>
176
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">warn</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
177
- <span class="ruby-identifier">first</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">shift</span>
178
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">first</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Class</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">first</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-constant">Warning</span>
179
- <span class="ruby-identifier">warning</span> = <span class="ruby-identifier">first</span>
180
- <span class="ruby-identifier">message</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">shift</span>
181
-
182
- <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">first</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Warning</span>
183
- <span class="ruby-identifier">warning</span> = <span class="ruby-identifier">first</span>.<span class="ruby-identifier">class</span>
184
- <span class="ruby-identifier">message</span> = <span class="ruby-identifier">first</span>.<span class="ruby-identifier">message</span>
185
-
186
- <span class="ruby-keyword">else</span>
187
- <span class="ruby-identifier">warning</span> = <span class="ruby-constant">StandardWarning</span>
188
- <span class="ruby-identifier">message</span> = <span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_s</span>
189
- <span class="ruby-keyword">end</span>
190
-
191
- <span class="ruby-comment"># If args is not empty, user passed an incompatible set of arguments.</span>
192
- <span class="ruby-comment"># Maybe somebody else is overriding warn as well and knows, what to do.</span>
193
- <span class="ruby-comment"># Better do nothing in this case. See #5</span>
194
- <span class="ruby-keyword">return</span> <span class="ruby-keyword">super</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>
195
-
196
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">warning</span>.<span class="ruby-identifier">active?</span>
197
- <span class="ruby-identifier">output</span> = <span class="ruby-constant">StructuredWarnings</span>.<span class="ruby-identifier">warner</span>.<span class="ruby-identifier">format</span>(<span class="ruby-identifier">warning</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">caller</span>(<span class="ruby-value">1</span>))
198
- <span class="ruby-keyword">super</span>(<span class="ruby-identifier">output</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">output</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">output</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">empty?</span>
199
- <span class="ruby-keyword">end</span>
200
- <span class="ruby-keyword">end</span></pre>
201
- </div>
202
-
203
- </div>
204
-
205
-
206
-
207
-
208
- </div>
209
-
210
-
211
- </section>
212
-
213
- </section>
214
- </main>
215
-
216
-
217
- <footer id="validator-badges" role="contentinfo">
218
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
219
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
220
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
221
- </footer>
222
-
@@ -1,97 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>module StructuredWarnings::Test - structured_warnings</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- </script>
12
-
13
- <script src="../js/jquery.js"></script>
14
- <script src="../js/darkfish.js"></script>
15
-
16
- <link href="../css/fonts.css" rel="stylesheet">
17
- <link href="../css/rdoc.css" rel="stylesheet">
18
-
19
-
20
-
21
- <body id="top" role="document" class="module">
22
- <nav role="navigation">
23
- <div id="project-navigation">
24
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
- <h2>
26
- <a href="../index.html" rel="home">Home</a>
27
- </h2>
28
-
29
- <div id="table-of-contents-navigation">
30
- <a href="../table_of_contents.html#pages">Pages</a>
31
- <a href="../table_of_contents.html#classes">Classes</a>
32
- <a href="../table_of_contents.html#methods">Methods</a>
33
- </div>
34
- </div>
35
-
36
- <div id="search-section" role="search" class="project-section initially-hidden">
37
- <form action="#" method="get" accept-charset="utf-8">
38
- <div id="search-field-wrapper">
39
- <input id="search-field" role="combobox" aria-label="Search"
40
- aria-autocomplete="list" aria-controls="search-results"
41
- type="text" name="search" placeholder="Search" spellcheck="false"
42
- title="Type to search, Up and Down to navigate, Enter to load">
43
- </div>
44
-
45
- <ul id="search-results" aria-label="Search Results"
46
- aria-busy="false" aria-expanded="false"
47
- aria-atomic="false" class="initially-hidden"></ul>
48
- </form>
49
- </div>
50
-
51
- </div>
52
-
53
-
54
-
55
- <div id="class-metadata">
56
-
57
-
58
-
59
-
60
-
61
- </div>
62
- </nav>
63
-
64
- <main role="main" aria-labelledby="module-StructuredWarnings::Test">
65
- <h1 id="module-StructuredWarnings::Test" class="module">
66
- module StructuredWarnings::Test
67
- </h1>
68
-
69
- <section class="description">
70
-
71
- <p>This module ecapsulates all extensions to support <code>test/unit</code>.</p>
72
-
73
- </section>
74
-
75
-
76
-
77
-
78
- <section id="5Buntitled-5D" class="documentation-section">
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
- </section>
89
- </main>
90
-
91
-
92
- <footer id="validator-badges" role="contentinfo">
93
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
94
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
95
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
96
- </footer>
97
-