Module: Gorillib

Defined in:
lib/gorillib/diff.rb,
lib/gorillib/resolution.rb

Defined Under Namespace

Modules: AnsiColors, DiffDisplayTools, DiffDrawerMethods, Model, Resolution Classes: DiffDrawer, DiffFormatter

Class Method Summary collapse

Class Method Details

.deep_copy(value) ⇒ Object

Make a clean deep-copy of the value, via gorillib semantics if

possible, otherwise via marshalling

9
10
11
12
13
14
15
16
# File 'lib/gorillib/resolution.rb', line 9

def self.deep_copy(value)
  case
  when ( value.respond_to? :to_wire and value.respond_to? :receive )
    return value.class.receive(value.to_wire)
  else
    return Marshal.load(Marshal.dump(value))
  end
end