Module: Excalibur::Duplicator
- Included in:
- Configuration, TruncateableContent
- Defined in:
- lib/excalibur/duplicator.rb
Overview
the Duplicator module helps in making sure duplication of nested objects functions properly and is used by the class Configuration and the class TruncableContent
Instance Method Summary collapse
-
#dup_instance(obj) ⇒ Object
duplicates TruncatableContent and calls the deep_dup method on any form of Hash.
Instance Method Details
#dup_instance(obj) ⇒ Object
duplicates TruncatableContent and calls the deep_dup method on any form of Hash. Otherwise return the object as not all objects do not need to be duplicated.
9 10 11 12 13 14 15 16 17 |
# File 'lib/excalibur/duplicator.rb', line 9 def dup_instance(obj) if obj.is_a?(TruncateableContent) obj.dup elsif obj.is_a?(Hash) obj.deep_dup else obj end end |