sickill/rainbow — pull request #12 by fcoury (2012-03-28 16:51:09+00:00)
Title: Fix for frozen strings

Fixes the problem when adding colors to frozen strings:

1.8.7 :006 > x="a"
=> "a"
1.8.7 :007 > x.color(:yellow)
=> "\e[33ma\e[0m"
1.8.7 :009 > x.freeze
=> "a"
1.8.7 :010 > x.color(:yellow)
TypeError: can't modify frozen string
from /Users/fcoury/.rvm/gems/ree-1.8.7-2011.12/gems/rainbow-1.1.3/lib/rainbow.rb:91:in `insert'
from /Users/fcoury/.rvm/gems/ree-1.8.7-2011.12/gems/rainbow-1.1.3/lib/rainbow.rb:91:in `wrap_with_code'
from /Users/fcoury/.rvm/gems/ree-1.8.7-2011.12/gems/rainbow-1.1.3/lib/rainbow.rb:33:in `color'
from (irb):10