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.
@@ -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:
@@ -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
@@ -43,7 +43,7 @@ module Warnings
43
43
  #
44
44
  def warn(message)
45
45
  if warnings?
46
- super(message) if $DEBUG
46
+ $stderr.puts(message) if $DEBUG
47
47
 
48
48
  $WARNINGS << Warning.new(message,caller)
49
49
  end
@@ -1,4 +1,4 @@
1
1
  module Warnings
2
2
  # warnings version
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
@@ -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
  #
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: warnings
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Postmodern