termcolor 0.3.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/termcolor.rb +10 -2
- data/spec/termcolor_spec.rb +2 -2
- metadata +2 -2
data/lib/termcolor.rb
CHANGED
@@ -7,7 +7,7 @@ require 'rexml/parsers/baseparser'
|
|
7
7
|
require 'rexml/streamlistener'
|
8
8
|
|
9
9
|
module TermColor
|
10
|
-
VERSION = '0.
|
10
|
+
VERSION = '1.0.0'
|
11
11
|
include REXML
|
12
12
|
|
13
13
|
class << self
|
@@ -30,7 +30,7 @@ module TermColor
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def unescape(text)
|
33
|
-
text.gsub(/&(lt|gt|amp|
|
33
|
+
text.gsub(/&(lt|gt|amp|quot|apos);/) do | match |
|
34
34
|
case match
|
35
35
|
when '&' then '&'
|
36
36
|
when '<' then '<'
|
@@ -44,6 +44,14 @@ module TermColor
|
|
44
44
|
def prepare_parse(text)
|
45
45
|
text.gsub(/<(\/?)(\d+)>/, '<\1_\2>')
|
46
46
|
end
|
47
|
+
|
48
|
+
def test(*args)
|
49
|
+
args = (0..109).to_a if args.empty?
|
50
|
+
args.each_with_index do |color, index|
|
51
|
+
print parse("<#{color}> #{color} </#{color}>") + "\t"
|
52
|
+
puts if (index + 1) % 10 == 0
|
53
|
+
end
|
54
|
+
end
|
47
55
|
end
|
48
56
|
|
49
57
|
class MyListener
|
data/spec/termcolor_spec.rb
CHANGED
@@ -36,11 +36,11 @@ module TermColor
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'should escape text' do
|
39
|
-
TermColor.escape('<>&"\'').should == "<>&&
|
39
|
+
TermColor.escape('<>&"\'').should == "<>&"'"
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should unescape text' do
|
43
|
-
TermColor.unescape("<>&&
|
43
|
+
TermColor.unescape("<>&"'").should == '<>&"\''
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'should prepare parse' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: termcolor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jugyo
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-30 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|