Module: Persistence::Object::Complex::Array::ObjectInstance
- Included in:
- Persistence::Object::Complex::Array
- Defined in:
- lib/persistence/object/complex/array/object_instance.rb
Overview
Instance methods for array objects enabled with persistence capabilities.
Instance Method Summary collapse
-
#load_persistence_value(attribute_name, attribute_value) ⇒ Object
load_persistence_value #.
-
#persist(*args) ⇒ Object
persist #.
-
#persistence_hash_to_port ⇒ Object
persistence_hash_to_port #.
Instance Method Details
#load_persistence_value(attribute_name, attribute_value) ⇒ Object
load_persistence_value #
50 51 52 |
# File 'lib/persistence/object/complex/array/object_instance.rb', line 50 def load_persistence_value( attribute_name, attribute_value ) push( attribute_value ) end |
#persist(*args) ⇒ Object
persist #
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/persistence/object/complex/array/object_instance.rb', line 11 def persist( *args ) index, key, no_key = parse_object_args_for_index_value_no_value( args, true ) if index global_id = index.get_object_id( key ) else global_id = key end persistence_bucket.adapter_bucket.get_object( global_id ).each do |this_index, this_value| self[ this_index ] = this_value end return self end |
#persistence_hash_to_port ⇒ Object
persistence_hash_to_port #
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/persistence/object/complex/array/object_instance.rb', line 33 def persistence_hash_to_port persistence_hash_instance = ::Persistence::Object::Complex::Attributes::HashToPort.new persistence_hash_instance.persistence_object = self self.each_with_index do |attribute_value, index| persistence_hash_instance[ index ] = attribute_value end return persistence_hash_instance end |