Sha256: 516e78fc39d936955a7f76e771c3eb919fa731918bfab95167b971e7aadd9ff4

Contents?: true

Size: 293 Bytes

Versions: 4

Compression:

Stored size: 293 Bytes

Contents

class Object
  # Anything that can be marshaled can be copied in totality.
  # This is also commonly called a deep_copy.
  #
  #   require 'facet/object/copy'
  #
  #   "ABC".copy  #=> "ABC"
  #
  def copy
    Marshal::load(Marshal::dump(self))
  end
  alias_method( :deep_copy, :copy )
end  

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-0.6.3 lib/facet/object/copy.rb
facets-0.7.0 lib/facet/object/copy.rb
facets-0.7.1 lib/facet/object/copy.rb
facets-0.7.2 lib/facet/object/copy.rb