Module: Persistence::Adapter::FlatFile::YAML::AdapterInterface

Includes:
AdapterInterface
Included in:
Persistence::Adapter::FlatFile::YAML
Defined in:
lib/persistence/adapter/flat_file/yaml/adapter_Interface.rb

Constant Summary

Constants included from AdapterInterface

AdapterInterface::Delimiter

Instance Attribute Summary

Attributes included from AdapterInterface

#parent_bucket

Instance Method Summary collapse

Methods included from AdapterInterface

#adapter_class, #delete_bucket_for_object_id, #delete_class_for_object_id, #ensure_object_has_globally_unique_id, #get_bucket_name_for_object_id, #initialize, #persistence_bucket

Instance Method Details

#get_class_for_object_id(global_id) ⇒ Object

get_class_for_object_id #



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/persistence/adapter/flat_file/yaml/adapter_Interface.rb', line 10

def get_class_for_object_id( global_id )
  
  if klass_string = open_read_unserialize_and_close( file__class_for_id( global_id ) )

    # for YAML - can't store anonymous Class, but sometimes we need to store "Class", so we store all class as string and get back
    klass = klass_string.split( '::' ).inject( Object ) { |namespace, next_part| namespace.const_get( next_part ) }
    
  end
  
  return klass

end