# File lib/pragma/decorator/association/adapter/base.rb, line 30 def primary_key fail NotImplementedError end
class Pragma::Decorator::Association::Adapter::Base
The base association adapter, defining the interface for the implementations.
@abstract Subclass and override {.supports?}, {#primary_key} and {#full_object} to
create a new adapter
@api private
Attributes
@!attribute [r] bond
@return [Bond] the bond this adapter has been instantiated with
Public Class Methods
Initializes the adapter.
@param bond [Bond] the bond to use
# File lib/pragma/decorator/association/adapter/base.rb, line 21 def initialize(bond) @bond = bond end
Public Instance Methods
Returns the full object of the association represented by the provided bond.
@return [Object] the full object
@abstract
# File lib/pragma/decorator/association/adapter/base.rb, line 39 def full_object fail NotImplementedError end
Returns the primary key of the association represented by the provided bond.
@return [String|Integer] the PK
@abstract
Protected Instance Methods
This is a convenience method returning the reflection defined on the bond.
@return [Object] the bond's associated object
# File lib/pragma/decorator/association/adapter/base.rb, line 59 def associated_object bond.associated_object end
This is a convenience method returning the model defined on the bond.
@return [Reflection] the bond's model
@see Bond#model
# File lib/pragma/decorator/association/adapter/base.rb, line 68 def model bond.model end
This is a convenience method returning the reflection defined on the bond.
@return [Reflection] the bond's reflection
@see Bond#reflection
# File lib/pragma/decorator/association/adapter/base.rb, line 50 def reflection bond.reflection end