Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Cloning Struct #15

@StefanoMartin

Description

@StefanoMartin

I am trying to deep clone a Struct element, but DeepClone does not seem to work as expected.

2.3.1 :001 > require "deep_clone"
 => true 
2.3.1 :002 > AStruct = Struct.new(:test)
 => AStruct 
2.3.1 :003 > a = AStruct.new("ciao")
 => #<struct AStruct test="ciao"> 
2.3.1 :004 > b = a.clone
 => #<struct AStruct test="ciao"> 
2.3.1 :005 > c = DeepClone.clone(a)
 => #<struct AStruct test="ciao"> 
2.3.1 :006 > a.test = "hello"
 => "hello" 
2.3.1 :007 > a
 => #<struct AStruct test="hello"> 
2.3.1 :008 > b
 => #<struct AStruct test="ciao"> 
2.3.1 :009 > c
 => #<struct AStruct test="hello">

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions