colorit 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/colorit/string.rb +7 -3
- data/lib/colorit/version.rb +1 -1
- metadata +2 -2
data/lib/colorit/string.rb
CHANGED
@@ -5,8 +5,12 @@ class String
|
|
5
5
|
# colorize an arbitrary string
|
6
6
|
#
|
7
7
|
def colorize(pattern, color)
|
8
|
-
|
9
|
-
|
8
|
+
begin
|
9
|
+
gsub(pattern) do
|
10
|
+
Colorit::Colors.all[color] + $& + Colorit::Colors.reset()
|
11
|
+
end
|
12
|
+
rescue ArgumentError
|
13
|
+
# rescue from invalid byte sequence in UTF-8
|
10
14
|
end
|
11
15
|
end
|
12
|
-
end
|
16
|
+
end
|
data/lib/colorit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: colorit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: colorit colors your console outputs using regular expressions to emphasize
|
15
15
|
special words in e.g. logfiles
|