warnings 0.1.0 → 0.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.
- data/ChangeLog.md +7 -0
- data/lib/warnings.rb +0 -18
- data/lib/warnings/mixin.rb +1 -1
- data/lib/warnings/version.rb +1 -1
- data/lib/warnings/warnings.rb +18 -0
- metadata +1 -1
data/ChangeLog.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
### 0.1.1 / 2011-06-24
|
2
|
+
|
3
|
+
* No longer call super in {Warnings::Mixing#warn}, to prevent duplicate
|
4
|
+
warnings being added to `$WARNINGS`.
|
5
|
+
* Moved the `at_exit` hook into `warnings/warnings` to ensure it is always
|
6
|
+
loaded.
|
7
|
+
|
1
8
|
### 0.1.0 / 2011-06-24
|
2
9
|
|
3
10
|
* Initial release:
|
data/lib/warnings.rb
CHANGED
@@ -3,21 +3,3 @@ require 'warnings/warnings'
|
|
3
3
|
require 'warnings/mixin'
|
4
4
|
|
5
5
|
include Warnings::Mixin
|
6
|
-
|
7
|
-
at_exit do
|
8
|
-
if (!$WARNINGS.empty? && ($VERBOSE || $DEBUG))
|
9
|
-
$stderr.puts
|
10
|
-
$stderr.puts "Warnings:"
|
11
|
-
$stderr.puts
|
12
|
-
|
13
|
-
unique_warnings = {}
|
14
|
-
|
15
|
-
$WARNINGS.each do |warning|
|
16
|
-
unique_warnings[warning.source_location] ||= warning
|
17
|
-
end
|
18
|
-
|
19
|
-
unique_warnings.each_value { |warning| warning.print }
|
20
|
-
|
21
|
-
$stderr.puts
|
22
|
-
end
|
23
|
-
end
|
data/lib/warnings/mixin.rb
CHANGED
data/lib/warnings/version.rb
CHANGED
data/lib/warnings/warnings.rb
CHANGED
@@ -2,6 +2,24 @@ module Warnings
|
|
2
2
|
# The global list of warnings
|
3
3
|
$WARNINGS ||= []
|
4
4
|
|
5
|
+
at_exit do
|
6
|
+
if (!$WARNINGS.empty? && ($VERBOSE || $DEBUG))
|
7
|
+
$stderr.puts
|
8
|
+
$stderr.puts 'Warnings:'
|
9
|
+
$stderr.puts
|
10
|
+
|
11
|
+
unique_warnings = {}
|
12
|
+
|
13
|
+
$WARNINGS.each do |warning|
|
14
|
+
unique_warnings[warning.source_location] ||= warning
|
15
|
+
end
|
16
|
+
|
17
|
+
unique_warnings.each_value { |warning| warning.print }
|
18
|
+
|
19
|
+
$stderr.puts
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
5
23
|
#
|
6
24
|
# Selects all warnings with a similar message.
|
7
25
|
#
|