Skip to content

Instantly share code, notes, and snippets.

@libryder
Created August 24, 2012 20:44
Show Gist options
  • Save libryder/6650ad5399333f09f695 to your computer and use it in GitHub Desktop.
Save libryder/6650ad5399333f09f695 to your computer and use it in GitHub Desktop.
cylon:home davidryder$ irb
1.9.3p194 :001 > str = "Hello my name is David"
=> "Hello my name is David"
1.9.3p194 :003 > str2 = str
=> "Hello my name is David"
1.9.3p194 :004 > str2.gsub("David", "Rocky")
=> "Hello my name is Rocky"
1.9.3p194 :005 > str
=> "Hello my name is David"
1.9.3p194 :006 > str2.gsub!("David", "Rocky")
=> "Hello my name is Rocky"
1.9.3p194 :007 > str
=> "Hello my name is Rocky"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment