Class: Forceps::ActsAsCopyableModel::DeepCopier
- Inherits:
-
Object
- Object
- Forceps::ActsAsCopyableModel::DeepCopier
- Defined in:
- lib/forceps/acts_as_copyable_model.rb
Instance Attribute Summary collapse
-
#copied_remote_objects ⇒ Object
Returns the value of attribute copied_remote_objects.
-
#level ⇒ Object
Returns the value of attribute level.
-
#options ⇒ Object
Returns the value of attribute options.
-
#reused_local_objects ⇒ Object
Returns the value of attribute reused_local_objects.
Instance Method Summary collapse
- #copy(remote_object) ⇒ Object
-
#initialize(options) ⇒ DeepCopier
constructor
A new instance of DeepCopier.
Constructor Details
#initialize(options) ⇒ DeepCopier
Returns a new instance of DeepCopier.
27 28 29 30 31 32 |
# File 'lib/forceps/acts_as_copyable_model.rb', line 27 def initialize() @copied_remote_objects = {} @reused_local_objects = Set.new @options = @level = 0 end |
Instance Attribute Details
#copied_remote_objects ⇒ Object
Returns the value of attribute copied_remote_objects.
25 26 27 |
# File 'lib/forceps/acts_as_copyable_model.rb', line 25 def copied_remote_objects @copied_remote_objects end |
#level ⇒ Object
Returns the value of attribute level.
25 26 27 |
# File 'lib/forceps/acts_as_copyable_model.rb', line 25 def level @level end |
#options ⇒ Object
Returns the value of attribute options.
25 26 27 |
# File 'lib/forceps/acts_as_copyable_model.rb', line 25 def @options end |
#reused_local_objects ⇒ Object
Returns the value of attribute reused_local_objects.
25 26 27 |
# File 'lib/forceps/acts_as_copyable_model.rb', line 25 def reused_local_objects @reused_local_objects end |
Instance Method Details
#copy(remote_object) ⇒ Object
34 35 36 |
# File 'lib/forceps/acts_as_copyable_model.rb', line 34 def copy(remote_object) cached_local_copy(remote_object) || perform_copy(remote_object) end |