color_debug_messages 1.1.2 → 1.1.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
1
+ 1.1.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{color_debug_messages}
8
- s.version = "1.1.2"
8
+ s.version = "1.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brent Sanders"]
@@ -24,19 +24,13 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "color_debug_messages.gemspec",
27
- "lib/color_debug_messages.rb",
28
- "test/helper.rb",
29
- "test/test_color_debug_messages.rb"
27
+ "lib/color_debug_messages.rb"
30
28
  ]
31
29
  s.homepage = %q{http://github.com/pdkl95/color_debug_messages}
32
30
  s.rdoc_options = ["--charset=UTF-8"]
33
31
  s.require_paths = ["lib"]
34
32
  s.rubygems_version = %q{1.3.5}
35
33
  s.summary = %q{Easy to read output on STDOUT}
36
- s.test_files = [
37
- "test/helper.rb",
38
- "test/test_color_debug_messages.rb"
39
- ]
40
34
 
41
35
  if s.respond_to? :specification_version then
42
36
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -16,43 +16,41 @@ module ColorDebugMessages
16
16
  # of flags. For example, to only have 'info' and 'warn' level
17
17
  # messages, with only class names and no function names, you could do:
18
18
  #
19
- # ColorDebugMessages.debug_flags = {
19
+ # ColorDebugMessages.global_debug_flags({
20
20
  # :debug => false,
21
21
  # :class_only => true
22
- # }
22
+ # })
23
23
  #
24
24
  # The hash is merged with the existing one, so it is not necessary
25
25
  # to name things that are already set the way you want.
26
- def self.debug_flags=(opts)
27
- debug_flags.merge! opts
26
+ def self.global_debug_flags(new_flags=nil)
27
+ @global_debug_flags ||= DEFAULT_DEBUG_FLAGS
28
+ @global_debug_flags.merge!(new_flags) if new_flags
29
+ @global_debug_flags
28
30
  end
29
-
30
- # returns the global flags
31
- def self.debug_flags
32
- @debug_flags ||= DEFAULT_DEBUG_FLAGS
31
+
32
+ def self.global_flag_active?(name)
33
+ global_debug_flags[name]
33
34
  end
34
35
 
35
36
  # This is the same as ColorDebugMessages#debug_flags but on a
36
37
  # per-instance level, if you need to locally change things for some
37
38
  # reason. This hash starts out blank, and any missing entries are
38
39
  # looked up in the global hash.
39
- def debug_flags=(opts)
40
- debug_flags.merge! opts
40
+ def debug_flags(new_flags=nil)
41
+ @local_debug_flags ||= Hash.new
42
+ @local_debug_flags = new_flags if new_flags
43
+ @local_debug_flags
41
44
  end
42
45
 
43
- # returns the per-instance flag overrides
44
- def debug_flags
45
- @color_debug_message_options ||= Hash.new
46
- end
47
-
48
46
  # returns +true+ if the flag is true in either the local instance
49
47
  # or the global hash.
50
48
  def debug_flag_active?(name)
51
49
  if debug_flags.has_key?(name)
52
- debug_flags
50
+ debug_flags[name]
53
51
  else
54
- ColorDebugMessages.debug_flags
55
- end[name]
52
+ ColorDebugMessages.global_debug_flags[name]
53
+ end
56
54
  end
57
55
 
58
56
  # returns the prefix to tag on debug messages for a class.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: color_debug_messages
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brent Sanders
@@ -40,8 +40,6 @@ files:
40
40
  - VERSION
41
41
  - color_debug_messages.gemspec
42
42
  - lib/color_debug_messages.rb
43
- - test/helper.rb
44
- - test/test_color_debug_messages.rb
45
43
  has_rdoc: true
46
44
  homepage: http://github.com/pdkl95/color_debug_messages
47
45
  licenses: []
@@ -70,6 +68,5 @@ rubygems_version: 1.3.5
70
68
  signing_key:
71
69
  specification_version: 3
72
70
  summary: Easy to read output on STDOUT
73
- test_files:
74
- - test/helper.rb
75
- - test/test_color_debug_messages.rb
71
+ test_files: []
72
+
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
-
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'color_debug_messages'
8
-
9
- class Test::Unit::TestCase
10
- end
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestColorDebugMessages < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end