rainbow 1.1.2 → 1.1.3
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/README.markdown +2 -0
- data/lib/rainbow.rb +5 -4
- data/test/rainbow_test.rb +6 -0
- metadata +2 -2
data/README.markdown
CHANGED
data/lib/rainbow.rb
CHANGED
@@ -86,10 +86,11 @@ module Sickill
|
|
86
86
|
def wrap_with_code(code) #:nodoc:
|
87
87
|
return self unless Sickill::Rainbow.enabled
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
89
|
+
var = self.clone
|
90
|
+
matched = var.match(/^(\e\[([\d;]+)m)*/)
|
91
|
+
var.insert(matched.end(0), "\e[#{code}m")
|
92
|
+
var.concat("\e[0m") unless var =~ /\e\[0m$/
|
93
|
+
var
|
93
94
|
end
|
94
95
|
|
95
96
|
end
|
data/test/rainbow_test.rb
CHANGED
@@ -106,6 +106,12 @@ class RainbowTest < Test::Unit::TestCase #:nodoc:
|
|
106
106
|
assert_equal "\e[8mhello\e[0m", "hello".hide
|
107
107
|
end
|
108
108
|
|
109
|
+
def test_immutability
|
110
|
+
string = "hello"
|
111
|
+
string.color(:red)
|
112
|
+
assert_equal string, "hello"
|
113
|
+
end
|
114
|
+
|
109
115
|
class MyString < String
|
110
116
|
end
|
111
117
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rainbow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-06 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: marcin.kulik@gmail.com
|