Created
November 28, 2010 02:34
-
-
Save amolbrid/718518 to your computer and use it in GitHub Desktop.
dup and clone difference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str = "Hello" | |
str.freeze | |
str_clone = str.clone | |
puts "str_clone is still frozen" if str_clone.frozen? | |
str_dup = str.dup | |
puts "str_dup is not frozen" unless str_dup.frozen? | |
# output: | |
# str_clone is still frozen | |
# str_dup is not frozen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment