term-ansicolor 1.1.3 → 1.1.4

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWQ4Yjg1MjdjMDU0NWRiYjAwZmNlOTZmMjRmMWY3NDhjZjA1ODI2MQ==
4
+ NmJjN2JlMmUwMTMwOGYzYzZjNTU2NGMyZDc2N2UyMDdmYmFlNTRjZg==
5
5
  data.tar.gz: !binary |-
6
- MGRkYzFmZGQzOTRkMDY0OGQwNjYwZTFhYjZkYWE3MjEyNDE2MTA0Mw==
6
+ ZGExZTJkNWY3NWQ5OGI0YmYyYjQ2ZGRiMDQyZGQ2OGJlYjUzNmY2Nw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MjU3MmI1YjhhN2NkZjRlNjJmOGY0MWU5NTJhYzZhNjJkYTQwNjdiYTY4NTVj
10
- YzM4MzUzZmRmMjI0MjE0YTEzNWI3NjIwOGYwN2UxZTNiNTk3NGY1ODU3ODU0
11
- MDllNTdjOWYyNjBjZmExNGYwNmU3ZmJjYWUwNDRmZGQ1OGI4NjM=
9
+ MGRjODI4NWNiMzAwY2MzODBlMzUzZTNiNWM0OTAxYzI5NmUyMmMxOGJlZTZi
10
+ ZDJkYTQ0ZTlhMjJlMzhlZTBkZTZjNmIyMDI5MzljOGJmZTUxZTk2N2QyN2Fi
11
+ OGExNjJkOTg5NzhmZTZmZjIxMWZkZmViMTc1NmU3ODI2MTgxZjQ=
12
12
  data.tar.gz: !binary |-
13
- ZTc2NDEwODcxNmFiY2M3NTNjOThlMjZhMGFhZTNiMDc3NmNhZWJmMGQ3MmI4
14
- MDRiNDI2MWE4MjdkMzU2MjczZTY3OTMwYzUxMGRlYmFiNWE1MjZjYzg1YmVh
15
- NDNhMWU2ZTUxYzEwZjM2YmExMjJhNjhiMDhmNGNhMmQ1MWJjZGE=
13
+ ZjhlZGUwNTExNDk2NTNjNWMyOTY5NWJmNzYzZjZjZDcxYWZiYjY4MjA3MGEx
14
+ MmM3ZTBiMzRkZjEyOTAzNzk0YjRkMjZiNjNkMzgwNTVkZTMwMjAzZTA2OTZh
15
+ YjcwZTI2MTI5ZmUzMzg3Y2Y0ZWY4ZWY0Nzc4MzU4ODcyMTE4Y2E=
data/CHANGES CHANGED
@@ -1,6 +1,6 @@
1
- 2013-03-26 - 1.1.3 * Fix a bug where respond_to could overflow the stack.
2
- * Easier access to color attributes via color(123) or
1
+ 2013-03-26 - 1.1.4 * Easier access to color attributes via color(123) or
3
2
  approximate html colors like color('#336caf').
3
+ 2013-03-26 - 1.1.3 * Fix a bug where respond_to could overflow the stack.
4
4
  2013-03-25 - 1.1.2 * Change the API: color0 - color255 to color(:color0) -
5
5
  color(:color255), and on_color0 to on_color(:color0) -
6
6
  on_color(:color255); the previous way caused some
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3
1
+ 1.1.4
@@ -185,12 +185,7 @@ module Term
185
185
  # color +name+. If string isn't a string only the escape sequence to switch
186
186
  # on the color +name+ is returned.
187
187
  def color(name, string = nil, &block)
188
- attribute = Attribute.get(name)
189
- attribute ||=
190
- name.to_s =~ /\Aon_/ ?
191
- Attribute.nearest_rgb_on_color(name) :
192
- Attribute.nearest_rgb_color(name)
193
- attribute or raise ArgumentError, "unknown attribute #{name.inspect}"
188
+ attribute = Attribute[name] or raise ArgumentError, "unknown attribute #{name.inspect}"
194
189
  result = ''
195
190
  result << "\e[#{attribute.code}m" if Term::ANSIColor.coloring?
196
191
  if block_given?
@@ -1,6 +1,6 @@
1
1
  module Term::ANSIColor
2
2
  # Term::ANSIColor version
3
- VERSION = '1.1.3'
3
+ VERSION = '1.1.4'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "term-ansicolor"
5
- s.version = "1.1.3"
5
+ s.version = "1.1.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Florian Frank"]
@@ -56,6 +56,13 @@ class ANSIColorTest < Test::Unit::TestCase
56
56
  assert_equal "\e[38;5;128mfoo\e[0m", "foo".color(:color128) { "foo" }
57
57
  assert_equal "\e[38;5;128mfoo\e[0m", color(:color128) { "foo" }
58
58
  assert_equal "\e[38;5;128mfoo\e[0m", color(:color128) + "foo" + color(:reset)
59
+ assert_equal "\e[38;5;128mfoo\e[0m", Color.color(128, "foo")
60
+ assert_equal "\e[38;5;128mfoo\e[0m", "foo".color(128)
61
+ assert_equal "\e[38;5;128mfoo\e[0m", color(128, "foo")
62
+ assert_equal "\e[38;5;128mfoo\e[0m", Color.color(128) { "foo" }
63
+ assert_equal "\e[38;5;128mfoo\e[0m", "foo".color(128) { "foo" }
64
+ assert_equal "\e[38;5;128mfoo\e[0m", color(128) { "foo" }
65
+ assert_equal "\e[38;5;128mfoo\e[0m", color(128) + "foo" + color(:reset)
59
66
  end
60
67
 
61
68
  def test_on_color
@@ -66,6 +73,13 @@ class ANSIColorTest < Test::Unit::TestCase
66
73
  assert_equal "\e[48;5;128mfoo\e[0m", "foo".on_color(:color128) { "foo" }
67
74
  assert_equal "\e[48;5;128mfoo\e[0m", on_color(:color128) { "foo" }
68
75
  assert_equal "\e[48;5;128mfoo\e[0m", on_color(:color128) + "foo" + color(:reset)
76
+ assert_equal "\e[48;5;128mfoo\e[0m", Color.on_color(128, "foo")
77
+ assert_equal "\e[48;5;128mfoo\e[0m", "foo".on_color(128)
78
+ assert_equal "\e[48;5;128mfoo\e[0m", on_color(128, "foo")
79
+ assert_equal "\e[48;5;128mfoo\e[0m", Color.on_color(128) { "foo" }
80
+ assert_equal "\e[48;5;128mfoo\e[0m", "foo".on_color(128) { "foo" }
81
+ assert_equal "\e[48;5;128mfoo\e[0m", on_color(128) { "foo" }
82
+ assert_equal "\e[48;5;128mfoo\e[0m", on_color(128) + "foo" + color(:reset)
69
83
  end
70
84
 
71
85
  def test_uncolor
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: term-ansicolor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank