Module: Persistence::Object::Complex::Hash::ClassInstance
- Defined in:
- lib/persistence/object/complex/hash/class_instance.rb
Overview
Class methods for hash objects enabled with persistence capabilities.
Instance Method Summary collapse
-
#persist(*args) ⇒ Object
persist #.
Instance Method Details
#persist(*args) ⇒ Object
persist #
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/persistence/object/complex/hash/class_instance.rb', line 11 def persist( *args ) index, key, no_key = parse_class_args_for_index_value_no_value( args, true ) if index global_id = index.get_object_id( key ) else global_id = key end object = new object.persistence_id = global_id hash_from_port = instance_persistence_bucket.get_object_hash( global_id ) hash_from_port.each do |this_key, this_value| if this_value.is_a?( ::Persistence::Object::Complex::ComplexObject ) this_value = this_value.persist object[ this_key ] = this_value else object[ this_key ] = this_value end end return object end |