Method: Pakyow::Presenter::View#soft_copy

Defined in:
lib/pakyow/presenter/view.rb

#soft_copyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/pakyow/presenter/view.rb', line 102

def soft_copy
  instance = self.class.allocate

  instance.instance_variable_set(:@info, @info.dup)

  new_object = @object.soft_copy
  instance.instance_variable_set(:@object, new_object)

  if new_object.respond_to?(:attributes)
    instance.attributes = new_object.attributes
  else
    instance.instance_variable_set(:@attributes, nil)
  end

  instance
end