Creating multiple copies of objects in Ruby
Since everything is an object in Ruby having a functionality that can duplicate objects is not a bad idea. Ruby ships with two methods for making copies of an object: the dup method and the clone method. In Ruby, all variables hold a reference to an object. In a case where a section of a code modifies an object that is not meant to be modified, it is ideal to make a copy of that object to be used in that section of the code, protecting the integrity of the copied object....