colcolor 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/colcolor.rb +2 -2
- data/lib/colcolor/version.rb +1 -1
- data/spec/colcolor_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 998fbf91dba3b59630eb91d225bd1e2a0eec9c99
|
4
|
+
data.tar.gz: cb57811e78534181c806ec84460167273dad0288
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5571f9959ad2d2e0bc897eef6c938f30a25b523c0f0db703e133abef963185bf8758d6336493683f2af60e1070110ce32f06442df57a9130dad70b72569b511
|
7
|
+
data.tar.gz: c82faa329536e755cab5700fcb75d20326fd60603eb8b376e8149304dcf567c7c683f738d84a8f1d45f50ae76bc414efc8617ed76e532db06b9853a0a3083a64
|
data/README.md
CHANGED
@@ -99,7 +99,7 @@ Output:
|
|
99
99
|
If you want to apply colors periodically to a text, set `cyclic` option to true.
|
100
100
|
|
101
101
|
```ruby
|
102
|
-
"H E L L O W O R L D".colco(:red, :green, :yellow,
|
102
|
+
"H E L L O W O R L D".colco(:red, :green, :yellow, cyclic:true)
|
103
103
|
|
104
104
|
```
|
105
105
|
|
data/lib/colcolor.rb
CHANGED
@@ -10,8 +10,8 @@ module Colcolor
|
|
10
10
|
BGCOLORS = TAGMAP(COLORSET, 40..47)
|
11
11
|
EXTRA = TAGMAP(%i(clear bold underline blink reverse), [0,1,4,5,7])
|
12
12
|
|
13
|
-
def colco(*colors, regexp:/\S+/,
|
14
|
-
cs =
|
13
|
+
def colco(*colors, regexp:/\S+/, cyclic:false)
|
14
|
+
cs = cyclic ? colors.cycle : colors.to_enum
|
15
15
|
self.gsub(regexp) do
|
16
16
|
cname = cs.next rescue nil
|
17
17
|
color = build_color_tag(cname)
|
data/lib/colcolor/version.rb
CHANGED
data/spec/colcolor_spec.rb
CHANGED
@@ -71,12 +71,12 @@ describe Colcolor do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
context "with
|
74
|
+
context "with cyclic option" do
|
75
75
|
it "applys colors cyclic to the text" do
|
76
76
|
str = "a b c d e f"
|
77
77
|
expect = "\e[31ma\e[0m \e[32mb\e[0m \e[33mc\e[0m \e[31md\e[0m \e[32me\e[0m \e[33mf\e[0m"
|
78
78
|
color_set = [:red, :green, :yellow]
|
79
|
-
expect(str.colco(*color_set,
|
79
|
+
expect(str.colco(*color_set, cyclic:true)).to eq expect
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: colcolor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kyoendo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|