Module: PDF::Core::Utils

Defined in:
lib/pdf/core/utils.rb

Overview

Utility methods

Class Method Summary collapse

Class Method Details

.deep_clone(object) ⇒ any

Deep clone an object. It uses marshal-demarshal trick. Since it’s supposed to be use only on objects that can be serialized into PDF it shouldn’t have any issues with objects that can not be marshaled.

Parameters:

  • object (any)

Returns:

  • (any)


16
17
18
# File 'lib/pdf/core/utils.rb', line 16

def deep_clone(object)
  Marshal.load(Marshal.dump(object))
end