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

bond[R]

@!attribute [r] bond

@return [Bond] the bond this adapter has been instantiated with

Public Class Methods

new(bond) click to toggle source

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

full_object() click to toggle source

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
primary_key() click to toggle source

Returns the primary key of the association represented by the provided bond.

@return [String|Integer] the PK

@abstract

# File lib/pragma/decorator/association/adapter/base.rb, line 30
def primary_key
  fail NotImplementedError
end

Protected Instance Methods

associated_object() click to toggle source

This is a convenience method returning the reflection defined on the bond.

@return [Object] the bond's associated object

@see Bond#associated_object

# File lib/pragma/decorator/association/adapter/base.rb, line 59
def associated_object
  bond.associated_object
end
model() click to toggle source

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
reflection() click to toggle source

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