# attr_accessor for class variable. # usage: # # ``` # class Pod # class_attr_accessor :is_prebuild_stage # end # ``` # def class_attr_accessor(symbol) self.class.send(:attr_accessor, symbol) end class Object def deep_clone return @deep_cloning_obj if @deep_cloning @deep_cloning_obj = clone @deep_cloning_obj.instance_variables.each do |var| val = @deep_cloning_obj.instance_variable_get(var) begin @deep_cloning = true val = val.deep_clone rescue TypeError next ensure @deep_cloning = false end @deep_cloning_obj.instance_variable_set(var, val) end deep_cloning_obj = @deep_cloning_obj @deep_cloning_obj = nil deep_cloning_obj end end