sickill/rainbow — Issue #9: Calling .color is changing variables
Author: fcoury
Created: 2011-12-01 23:20:38+00:00
State: open

Rainbow 1.1.2 behavior (wrong! - the variable is changed):

$ gem install rainbow
Fetching: rainbow-1.1.2.gem (100%)
Successfully installed rainbow-1.1.2
1 gem installed

$ irb
ree-1.8.7-2011.03 :001 > require 'rainbow'
=> true
ree-1.8.7-2011.03 :002 > @string = "color-me-blind"
=> "color-me-blind"
ree-1.8.7-2011.03 :003 > @string.color(:yellow)
=> "\e[33mcolor-me-blind\e[0m"
ree-1.8.7-2011.03 :004 > @string
=> "\e[33mcolor-me-blind\e[0m"

Rainbow 1.1.1 behavior (correct - @string is not touched):

$ gem list rainbow

*** LOCAL GEMS ***

rainbow (1.1.1)

$ irb
ree-1.8.7-2011.03 :003 > require 'rainbow'
=> true
ree-1.8.7-2011.03 :004 > @string = "color-me-blind"
=> "color-me-blind"
ree-1.8.7-2011.03 :005 > @string.color(:yellow)
=> "\e[33mcolor-me-blind\e[0m"
ree-1.8.7-2011.03 :006 > @string
=> "color-me-blind"