jugyo-termcolor 1.0.0 → 1.1.0

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.
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 = '1.0.0'
10
+ VERSION = '1.1.0'
11
11
  include REXML
12
12
 
13
13
  class << self
@@ -52,6 +52,10 @@ module TermColor
52
52
  puts if (index + 1) % 10 == 0
53
53
  end
54
54
  end
55
+
56
+ def colorize(text, color)
57
+ parse("<#{color}>#{escape(text)}</#{color}>")
58
+ end
55
59
  end
56
60
 
57
61
  class MyListener
@@ -59,5 +59,9 @@ module TermColor
59
59
  listener.to_esc_seq('_0').should == "\e[0m"
60
60
  listener.to_esc_seq('_31').should == "\e[31m"
61
61
  end
62
+
63
+ it 'should do colorize' do
64
+ TermColor.colorize('test', :green).should == "\e[32mtest\e[0m"
65
+ end
62
66
  end
63
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jugyo-termcolor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.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-04-08 00:00:00 -07:00
12
+ date: 2009-05-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency