Module: Persistence::Object::Flat::ClassInstance

Defined in:
lib/persistence/object/flat/class_instance.rb

Overview

Class methods for flat objects enabled with persistence capabilities.

Instance Method Summary collapse

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
# File 'lib/persistence/object/flat/class_instance.rb', line 11

def persist( *args )

  persistence_value = nil

  index_instance, key, no_key = parse_class_args_for_index_value_no_value( args )

  # if no key, open a cursor for a list
  if no_key

    persistence_value = ::Persistence::Cursor.new( instance_persistence_bucket, index_instance )

  else

    global_id = index_instance ? index_instance.get_object_id( key ) : key
    
    persistence_value = instance_persistence_bucket.get_flat_object( global_id )

  end
  
  return persistence_value

end