termcolorlight 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28b23d731c9a8c265527f0a6677348b9d1239a2e
4
- data.tar.gz: 8cef95a72714128501ab9efe486b2b26de59b78b
3
+ metadata.gz: ffa13ca897e6881bb281555422245409cfc950ca
4
+ data.tar.gz: 8e182856b0a394e7481238d0ba6313df8f889321
5
5
  SHA512:
6
- metadata.gz: 33ca0d6f75a7f5805238ea67eaafa72093988bc41fb9b508e5702ad2431c507214d5d141ec29d680a26e97c9f9ad26de32fb7e7b9350a8a54a9f32a700772f36
7
- data.tar.gz: 21d0b782675993fb7cb93af9353695d027b43fea17c4f6ee0011356e7c1abf582a733f14440c53e982557ee9447bf5df41dab658b7c9e6c6cc2b18b4044122be
6
+ metadata.gz: 0f123d1175bef301adf5e07f8b85d8fdef1e517a748a392b63ec27a41a017553d213db30fca74c995c90a76d496f550a3a41f8a69f144b6553f9ae19839203b0
7
+ data.tar.gz: a36cb8766a5c4c014902f2ba377b072a915701be0f77ab8fb5fe1e5a2f9ff89946b91c6b3eb365c3623a36dcc58126afb73c5b175a419122709e35ba1b7927df
data/README.md CHANGED
@@ -1,10 +1,8 @@
1
1
  # TermColorLight
2
2
 
3
3
  This gem is library that convert color tags (e.g. `<red>str</red>` ) to
4
- ansicolor(vt100 escape sequence).
5
-
6
- Lightweight version of TermColor.gem.
7
- No use other gems, it is very simply.
4
+ ansicolor(vt100 escape sequence). And this's lightweight version of
5
+ TermColor.gem without other gems. In addition process spedd is surprisingly fast.
8
6
 
9
7
  ## Installation
10
8
 
@@ -47,6 +45,55 @@ on_black, on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white, o
47
45
  bold, dark, underline, underscore, blink, reverse, concealed
48
46
  ```
49
47
 
48
+ ## Benchmark
49
+
50
+ ### Code
51
+
52
+ ```ruby
53
+ require "termcolor"
54
+ require "termcolorlight"
55
+ require "benchmark"
56
+
57
+ n = 100000
58
+ Benchmark.bm(20) do |bm|
59
+ bm.report "TermColor.parse" do
60
+ n.times do
61
+ TermColor.parse("<red>red</red>")
62
+ end
63
+ end
64
+ bm.report "TermColorLight.parse" do
65
+ n.times do
66
+ TermColorLight.parse("<red>red</red>")
67
+ end
68
+ end
69
+ end
70
+ ```
71
+
72
+ ### Results
73
+
74
+ > Performed by OSX.
75
+
76
+ Use ruby 2.0.0p451
77
+
78
+ ```
79
+ user system total real
80
+ TermColor.parse 13.770000 5.830000 19.600000 ( 19.595587)
81
+ TermColorLight.parse 2.880000 0.010000 2.890000 ( 2.899383)
82
+ ```
83
+
84
+ You could see that processing speed of TermColorLight is much faster
85
+ than TermColor's one.
86
+
87
+ Use ruby 2.2.0 (2014-08-20 trunk 47225 [x86_64-darwin13])
88
+
89
+ ```
90
+ user system total real
91
+ TermColor.parse 12.960000 4.720000 17.680000 ( 17.674688)
92
+ TermColorLight.parse 0.850000 0.000000 0.850000 ( 0.853439)
93
+ ```
94
+
95
+ Oops...
96
+
50
97
  ## Contributing
51
98
 
52
99
  1. Fork it ( https://github.com/whiteleaf7/termcolorlight/fork )
data/benchmark.rb ADDED
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+
3
+ require "termcolor"
4
+ require "termcolorlight"
5
+ require "benchmark"
6
+
7
+ n = 100000
8
+ Benchmark.bm(20) do |bm|
9
+ bm.report "TermColor.parse" do
10
+ n.times do
11
+ TermColor.parse("<red>red</red>")
12
+ end
13
+ end
14
+ bm.report "TermColorLight.parse" do
15
+ n.times do
16
+ TermColorLight.parse("<red>red</red>")
17
+ end
18
+ end
19
+ end
@@ -6,9 +6,9 @@
6
6
  require "strscan"
7
7
 
8
8
  module TermColorLight
9
- extend self
9
+ module_function
10
10
 
11
- VERSION = "1.0.0"
11
+ VERSION = "1.0.1"
12
12
 
13
13
  TAGS = {
14
14
  # foreground colors
@@ -14,11 +14,9 @@ Gem::Specification.new do |spec|
14
14
  spec.email = ["2nd.leaf@gmail.com"]
15
15
  spec.summary = "convert color tags to ansicolor library"
16
16
  spec.description = <<-EOS
17
- This gem is library that convert color tags (e.g. `<red>str</red>` ) to
18
- ansicolor(vt100 escape sequence).
19
-
20
- Lightweight version of TermColor.gem.
21
- No use other gems, it is very simply.
17
+ This gem is library that convert color tags (e.g. <red>str</red>) to
18
+ ansicolor(vt100 escape sequence). And this's lightweight version of
19
+ TermColor.gem without other gems. In addition process spedd is surprisingly fast.
22
20
  EOS
23
21
  spec.homepage = "http://github.com/whiteleaf7/termcolorlight"
24
22
  spec.license = "MIT"
@@ -28,3 +26,4 @@ No use other gems, it is very simply.
28
26
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
29
27
  spec.require_paths = ["lib"]
30
28
  end
29
+
metadata CHANGED
@@ -1,21 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: termcolorlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - whiteleaf7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-05 00:00:00.000000000 Z
11
+ date: 2014-09-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
- This gem is library that convert color tags (e.g. `<red>str</red>` ) to
15
- ansicolor(vt100 escape sequence).
16
-
17
- Lightweight version of TermColor.gem.
18
- No use other gems, it is very simply.
14
+ This gem is library that convert color tags (e.g. <red>str</red>) to
15
+ ansicolor(vt100 escape sequence). And this's lightweight version of
16
+ TermColor.gem without other gems. In addition process spedd is surprisingly fast.
19
17
  email:
20
18
  - 2nd.leaf@gmail.com
21
19
  executables: []
@@ -27,6 +25,7 @@ files:
27
25
  - LICENSE.txt
28
26
  - README.md
29
27
  - Rakefile
28
+ - benchmark.rb
30
29
  - lib/termcolorlight.rb
31
30
  - spec/termcolorlight_spec.rb
32
31
  - termcolorlight.gemspec