colcolor 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b446b52f24f036ce96faa3871612c17f3c1e283
4
- data.tar.gz: 2b86dacefabce35110164cf3a926eaf65d679a90
3
+ metadata.gz: 1e0f1528e02ce7d5dc2f43daf6d4fa700dd656c2
4
+ data.tar.gz: 1a546ff89d31b8656046f4cbe0fbd2c41163e3f2
5
5
  SHA512:
6
- metadata.gz: e6892c801857814a2b72b9ee6635b96d999be9364f1015d5166ecacfd5fc770bf67ed8a08384a3c617679ff5972c97199aebd3ebecf3288a6e1f9a7729ce0502
7
- data.tar.gz: 0ef2a6ff5fb5946c136a5170e1ad89eb4ba653ace9538e4e4a0af4f1b0ee20839e72b5f15539eff7a16076788987bd879b8ee3fd5dd5d80f9ce5b23b66fdf8ff
6
+ metadata.gz: dfbea0605bd114ac7d298243634977a547029093169236ce8dd3bf3764c02cce1fed224b3c3825c7c5cc268999157d0ff81ad90346cdeec0a5677e1702d70d90
7
+ data.tar.gz: 05d54f0949d93d39a1791466327a83d0ed1ebc94ffcee825cde620e6d2d33e0f213db3540a53de8ff1524f3e5937ab24f77f2c53bbf285411de89bca4762654c
@@ -13,7 +13,7 @@ module Colcolor
13
13
  cs = colors.dup
14
14
  self.gsub(regexp) do
15
15
  color = build_color_tag(cs.shift)
16
- color + $& + EXTRA[:clear]
16
+ color.empty? ? $& : (color + $& + EXTRA[:clear])
17
17
  end
18
18
  end
19
19
 
@@ -1,3 +1,3 @@
1
1
  module Colcolor
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -27,21 +27,21 @@ describe Colcolor do
27
27
  context "two or more color attributes to a word" do
28
28
  it "colors a word with two attrs" do
29
29
  str = "Charlie is great!"
30
- expect = "\e[32mCharlie\e[0m is\e[0m \e[31m\e[4mgreat!\e[0m"
30
+ expect = "\e[32mCharlie\e[0m is \e[31m\e[4mgreat!\e[0m"
31
31
  color_set = [:green, nil, :red_underline]
32
32
  expect(str.colco(*color_set)).to eq expect
33
33
  end
34
34
 
35
35
  it "colors a word with three attrs" do
36
36
  str = "Charlie is great!"
37
- expect = "\e[32mCharlie\e[0m is\e[0m \e[31m\e[43m\e[4mgreat!\e[0m"
37
+ expect = "\e[32mCharlie\e[0m is \e[31m\e[43m\e[4mgreat!\e[0m"
38
38
  color_set = [:green, nil, :red_yellow_underline]
39
39
  expect(str.colco(*color_set)).to eq expect
40
40
  end
41
41
 
42
42
  it "colors a word with color attrs but no foreground" do
43
43
  str = "Charlie is great!"
44
- expect = "\e[32mCharlie\e[0m is\e[0m \e[43m\e[4mgreat!\e[0m"
44
+ expect = "\e[32mCharlie\e[0m is \e[43m\e[4mgreat!\e[0m"
45
45
  color_set = [:green, nil, :_yellow_underline]
46
46
  expect(str.colco(*color_set)).to eq expect
47
47
  end
@@ -49,13 +49,13 @@ describe Colcolor do
49
49
 
50
50
  context "short colors" do
51
51
  it "colors a word white for missing color" do
52
- expect = "\e[32mGeorge\e[0m \e[33m18\e[0m guitarist\e[0m"
52
+ expect = "\e[32mGeorge\e[0m \e[33m18\e[0m guitarist"
53
53
  color_set = [:green, :yellow]
54
54
  expect(@str.colco(*color_set)).to eq expect
55
55
  end
56
56
 
57
57
  it "colors a word white at intermidiate" do
58
- expect = "\e[32mGeorge\e[0m 18\e[0m \e[31mguitarist\e[0m"
58
+ expect = "\e[32mGeorge\e[0m 18 \e[31mguitarist\e[0m"
59
59
  color_set = [:green, nil, :red]
60
60
  expect(@str.colco(*color_set)).to eq expect
61
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colcolor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kyoendo