Module: Persistence::Adapter::Abstract::PrimaryKey::IDPropertyString

Defined in:
lib/persistence/adapter/abstract/primary_key/id_property_string.rb

Overview

Provides primary key with the object’s persistence_id and the attribute name, connected by

self.class::Delimiter in including adapter class.

Constant Summary collapse

Delimiter =
'.'

Instance Method Summary collapse

Instance Method Details

#primary_key_for_attribute_name(object, attribute_name) ⇒ Object

Returns a primary key for storage in adapter (self). Generated from object instance and attribute name.

Any further constraints are a function of the adapter's requirements, not of Persistence.
This implementation returns a string with the object's persistence_id and the attribute name, connected by
self.class::Delimiter in including adapter class.

Parameters:

  • object

    Object instance for which to generate primary key.

  • attribute_name

    Attribute name key refers to.

Returns:

  • String Primary key for use in adapter (self).



27
28
29
30
31
# File 'lib/persistence/adapter/abstract/primary_key/id_property_string.rb', line 27

def primary_key_for_attribute_name( object, attribute_name )

  return object.persistence_id.to_s << self.class::Delimiter << attribute_name.to_s

end