rainbow 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,8 @@
1
1
  Rainbow
2
2
  =======
3
3
 
4
+ ![build status](https://secure.travis-ci.org/sickill/rainbow.png)
5
+
4
6
  About
5
7
  -----
6
8
 
@@ -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
- matched = match(/^(\e\[([\d;]+)m)*/)
90
- insert(matched.end(0), "\e[#{code}m")
91
- concat("\e[0m") unless self =~ /\e\[0m$/
92
- self
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
@@ -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.2
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-11-13 00:00:00.000000000Z
12
+ date: 2011-12-06 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: marcin.kulik@gmail.com