termcolor 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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: 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-30 00:00:00 +09:00
12
+ date: 2009-10-18 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -41,6 +41,8 @@ files:
41
41
  - Rakefile
42
42
  has_rdoc: true
43
43
  homepage: http://github.com/jugyo/termcolor
44
+ licenses: []
45
+
44
46
  post_install_message:
45
47
  rdoc_options:
46
48
  - --main
@@ -64,9 +66,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
66
  requirements: []
65
67
 
66
68
  rubyforge_project: termcolor
67
- rubygems_version: 1.3.1
69
+ rubygems_version: 1.3.4
68
70
  signing_key:
69
- specification_version: 2
71
+ specification_version: 3
70
72
  summary: Termcolor is a library for ANSI color formatting like HTML for output in terminal.
71
73
  test_files: []
72
74