阅读背景:

dup和clone都返回不同的对象,但修改它们会改变原始对象

来源:互联网 

I have an array of values that I use as a reference for order when I'm printing out hash values. I'd like to modify the array so that the array values are "prettier". I figured I'd just dup or clone the array, change the values and the original object would remain unchanaged. However (in irb)...I have an array of values that I use as a refer




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: