В
Size: a a a
В
В
E
deep_dup
E
2.6.3 :001 > class A
2.6.3 :002?> attr_accessor :x
2.6.3 :003?> def initialize(x)
2.6.3 :004?> @x = x
2.6.3 :005?> end
2.6.3 :006?> end
=> :initialize
2.6.3 :007 > a = A.new(5)
=> #<A:0x00007fffe5b870a8 @x=5>
2.6.3 :008 > h = {a => "b"}
=> {#<A:0x00007fffe5b870a8 @x=5>=>"b"}
2.6.3 :009 > h2 = h.clone
=> {#<A:0x00007fffe5b870a8 @x=5>=>"b"}
2.6.3 :010 > a.x = 6
=> 6
2.6.3 :011 > h
=> {#<A:0x00007fffe5b870a8 @x=6>=>"b"}
2.6.3 :012 > h2
=> {#<A:0x00007fffe5b870a8 @x=6>=>"b"}
AV
AV
G
V
2.6.3 :001 > class A
2.6.3 :002?> attr_accessor :x
2.6.3 :003?> def initialize(x)
2.6.3 :004?> @x = x
2.6.3 :005?> end
2.6.3 :006?> end
=> :initialize
2.6.3 :007 > a = A.new(5)
=> #<A:0x00007fffe5b870a8 @x=5>
2.6.3 :008 > h = {a => "b"}
=> {#<A:0x00007fffe5b870a8 @x=5>=>"b"}
2.6.3 :009 > h2 = h.clone
=> {#<A:0x00007fffe5b870a8 @x=5>=>"b"}
2.6.3 :010 > a.x = 6
=> 6
2.6.3 :011 > h
=> {#<A:0x00007fffe5b870a8 @x=6>=>"b"}
2.6.3 :012 > h2
=> {#<A:0x00007fffe5b870a8 @x=6>=>"b"}