color_echo 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bb34e234d1acce0b26eda0cfac75c2bc98f7b7f
4
- data.tar.gz: 81bfc6f30d698dbd09bb4e7fed2a141e0e499468
3
+ metadata.gz: d7d3a8d427f0500c579883ec1383e41f925a3d29
4
+ data.tar.gz: fe121aaf4ccf3b4e47df7c416c8a6629b0b9798c
5
5
  SHA512:
6
- metadata.gz: bc1963db6bdf205aae374a8e7cc7c4dc62de956e5f2af09db53e9d6391356a5378ae2947c22c330bf2b5a8b63e0bd054c909f55e5b3665b1f499ba0f387e31cd
7
- data.tar.gz: 9a42346beef4d45057fbe4f927096d5d2fafc2c3d8ecf3eef41e9b802cfc5f632630a815324a4cf81c2e9eec2ca6fcd516f12a22d8cd9c0157dddcf66ac54248
6
+ metadata.gz: 4b37774a01401322360023eba2f8af2fa1a48a0982eb6ae14c0ec96f8567b0351605ac0ccca55cf1af1f9ebbdc5eee55bb1ed9da2b1f8f127b991b1e16780a70
7
+ data.tar.gz: ad2b93edfe490738e6e73e3a26372df536a73c7b1328410176a38e60c951c2cfa759798759f22925838dd22a529b60ee1b8c7802fa971d23c38aa715f5bde2ac
data/README.md CHANGED
@@ -3,7 +3,7 @@ To add color to the command line output.
3
3
  This Library will extend the Kernel module's functions(#print, #puts, #p).
4
4
  required StringIO.
5
5
 
6
- Version: 0.2.2
6
+ Version: 0.2.3
7
7
  Compliant Rubys Version: 1.9.3, 2.0.0, 2.1.0 (for Linux)
8
8
  License: MIT
9
9
  Gems repository: http://rubygems.org/gems/color_echo
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
  ### module functions
24
24
  #### CE.ch_fg :symbol
25
25
  Change the foreground color to the your specified color.
26
- Alias is, CE.fg
26
+ Alias is, fg
27
27
  This method alias is available in version 0.2.0 on and after.
28
28
 
29
29
  * symbol list:
@@ -40,7 +40,7 @@ ex.) CE.ch_fg :red #=> foreground color will be changed red
40
40
 
41
41
  #### CE.ch_bg :symbol
42
42
  Change the background color to the your specified color.
43
- Alias is, CE.bg
43
+ Alias is, bg
44
44
  This method alias is available in version 0.2.0 on and after.
45
45
 
46
46
 
@@ -67,10 +67,9 @@ Change the text attribute to the your specified decoration.
67
67
  * concealed
68
68
 
69
69
  ex.) CE.ch_tx :blink #=> text blink on
70
- Alias is, CE.tx
70
+ Alias is, tx
71
71
  This method alias is available in version 0.2.0 on and after.
72
72
 
73
-
74
73
  #### CE.ch :foreground [,:background [,:text_attribute]]
75
74
  Change collectively.
76
75
  This method is available in version 0.1.0 on and after.
@@ -78,7 +77,7 @@ ex.) CE.ch :white, :green
78
77
 
79
78
  #### CE.reset
80
79
  Reset to set the color sequence.
81
- Alias is, CE::off, CE::disable
80
+ Alias is, off, disable
82
81
  This method alias is available in version 0.1.0 on and after.
83
82
 
84
83
  #### CE.unuse
@@ -86,65 +85,89 @@ Force ignore the function of this library.
86
85
  This method is available in version 0.1.0 on and after.
87
86
 
88
87
  #### CE.rainbow
89
- Enjoy rainbow.
88
+ Text color will change to rainbow color.
89
+ String Object only.
90
+ Non-string object is excluded.
90
91
  This method is available in version 0.2.0 on and after.
91
92
 
92
93
  ### Example
93
- <pre>
94
+ ```ruby
94
95
  #
95
96
  # Example Code
96
97
  #
97
98
  require "color_echo"
98
99
 
99
100
  # force ignore the function of this library
100
- #CE::unuse
101
+ #CE.unuse
101
102
 
102
103
  CE.ch :yellow
103
104
  puts "fooooooooo"
104
105
  puts "baaaaaaaar"
106
+ puts "AAAAA", "BBBBB", "CCCCC"
105
107
 
106
108
  CE.ch :white, :red
107
- print "testtesttest"
109
+ print "fooooooooo"
110
+ print "baaaaaaaar"
111
+ print "AAAAA", "BBBBB", "CCCCC"
112
+
113
+ CE.ch :black, :magenta, :underscore
114
+ p "fooooooooo"
115
+ p "baaaaaaaar"
116
+ p "AAAAA", "BBBBB", "CCCCC"
108
117
 
109
- CE.ch :black, :cyan, :underscore
110
118
  ary = ["Duis", "aute", "irure", "dolor", "in", "reprehenderit", "in", "voluptate"]
111
- p ary
112
- print ary
113
119
 
114
120
  CE.off
121
+ puts "turn off all colors and attribute."
115
122
 
116
- CE.fg :white
117
- p "aaaaa", "bbbbb", "ccccc", "ddddd", "eeeee"
123
+ CE.fg :red
124
+ puts ary
118
125
 
119
- CE.bg :magenta
126
+ CE.bg :cyan
120
127
  print ary
121
128
 
122
- CE.reset
123
- puts "hogehoge"
124
-
125
129
  CE.tx :underscore
126
- puts "hogehoge"
130
+ p ary
127
131
 
128
132
  CE.ch :black, :white, :blink
129
- puts &lt;&lt;EOM
133
+ puts <<EOM
130
134
  Lorem ipsum dolor sit amet,
131
135
  consectetur adipisicing elit,
132
136
  sed do eiusmod tempor incididunt
133
- ut labore et dolore magna aliqua.
137
+ ut labore et dolore magna aliqua.
134
138
  EOM
135
139
 
136
140
  CE.rainbow
137
- puts "String will be rainbow! You can specify the argument only one."
138
- puts ["rainbow", "is", "String", "only"]
139
- puts "this is rainbow.", "This argument is ignored when rainbow mode."
141
+ puts "fooooooooo"
142
+ puts "baaaaaaaar"
143
+ puts "AAAAA", "BBBBB", "CCCCC"
144
+ puts ary
140
145
 
141
- CE.rainbow
142
- puts &lt;&lt;EOS
143
- aaaaaaaaaaaaaaaaaaa
144
- aaaaaaaaaaaaaaaaaaa
145
- aaaaaaaaaaaaaaaaaaa
146
- EOS
146
+ print "fooooooooo"
147
+ print "baaaaaaaar"
148
+ print "AAAAA", "BBBBB", "CCCCC"
149
+ print ary
150
+
151
+ p "fooooooooo"
152
+ p "baaaaaaaar"
153
+ p "AAAAA", "BBBBB", "CCCCC"
154
+ p ary
155
+
156
+ puts <<EOM
157
+ Lorem ipsum dolor sit amet,
158
+ consectetur adipisicing elit,
159
+ sed do eiusmod tempor incididunt
160
+ ut labore et dolore magna aliqua.
161
+ EOM
147
162
 
148
163
  CE.off
149
164
  puts "Disable rainbow mode."
150
- </pre>
165
+ ```
166
+
167
+ #### Result
168
+
169
+ ![screen shot](/images/screenshot.png)
170
+
171
+
172
+ ## Release Note
173
+ * v0.2.3, 2014-12-02, Fixed small bugs.
@@ -13,10 +13,18 @@ module CE
13
13
  @@task = lambda do |*arg|
14
14
  if available?
15
15
  if @@rainbow && arg.first.instance_of?(String)
16
- arg = add_rainbow(arg.first)
16
+ # change output destination to StringIO Object
17
+ strio = StringIO.new
18
+ $stdout = strio
17
19
 
18
20
  # call original method
19
- eval("@@#{caller_locations(2).first.label}").call(arg)
21
+ eval("@@#{caller_locations(2).first.label}").call(*arg)
22
+
23
+ # change output destination to STDOUT
24
+ $stdout = STDOUT
25
+
26
+ # output to STDOUT
27
+ $stdout.print add_rainbow(strio.string)
20
28
 
21
29
  else
22
30
  # change output destination to StringIO Object
@@ -27,7 +35,7 @@ module CE
27
35
  $stdout.print get_start_code
28
36
 
29
37
  # call original method
30
- eval("@@#{caller_locations(2).first.label}").call(arg)
38
+ eval("@@#{caller_locations(2).first.label}").call(*arg)
31
39
 
32
40
  # change output destination to STDOUT
33
41
  $stdout = STDOUT
@@ -39,7 +47,7 @@ module CE
39
47
  # no available "color echo"
40
48
  else
41
49
  # call original method
42
- eval("@@#{caller_locations(2).first.label}").call(arg)
50
+ eval("@@#{caller_locations(2).first.label}").call(*arg)
43
51
  end
44
52
  end
45
53
  end
@@ -1,3 +1,3 @@
1
1
  module CE
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: color_echo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - nyanko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-28 00:00:00.000000000 Z
11
+ date: 2014-12-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'To add color to the command line output.This Library will extend the
14
14
  Kernel module''s functions(#print, #puts, #p). required StringIO.'