Class: Amoeba::Cloner

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/amoeba/cloner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, options = {}) ⇒ Cloner

Returns a new instance of Cloner.



16
17
18
19
20
21
22
# File 'lib/amoeba/cloner.rb', line 16

def initialize(object, options = {})
  @old_object = object
  @options    = options
  @object_klass = @old_object.class
  inherit_parent_settings
  @new_object = object.__send__(amoeba.dup_method)
end

Instance Attribute Details

#new_objectObject (readonly)

Returns the value of attribute new_object.



9
10
11
# File 'lib/amoeba/cloner.rb', line 9

def new_object
  @new_object
end

#object_klassObject (readonly)

Returns the value of attribute object_klass.



9
10
11
# File 'lib/amoeba/cloner.rb', line 9

def object_klass
  @object_klass
end

#old_objectObject (readonly)

Returns the value of attribute old_object.



9
10
11
# File 'lib/amoeba/cloner.rb', line 9

def old_object
  @old_object
end

Instance Method Details

#runObject



24
25
26
27
28
29
# File 'lib/amoeba/cloner.rb', line 24

def run
  process_overrides
  apply if amoeba.enabled
  after_apply if amoeba.do_preproc
  @new_object
end