Class: Pragma::Decorator::Association::Adapter::Base Abstract Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pragma/decorator/association/adapter/base.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is abstract.

Subclass and override supports?, #primary_key and #full_object to create a new adapter

The base association adapter, defining the interface for the implementations.

Direct Known Subclasses

ActiveRecord, Poro

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bond) ⇒ Base

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes the adapter.

Parameters:

  • bond (Bond)

    the bond to use



21
22
23
# File 'lib/pragma/decorator/association/adapter/base.rb', line 21

def initialize(bond)
  @bond = bond
end

Instance Attribute Details

#bondObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/pragma/decorator/association/adapter/base.rb', line 16

def bond
  @bond
end

Instance Method Details

#full_objectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method is abstract.

Returns the full object of the association represented by the provided bond.

Returns:

  • (Object)

    the full object



39
40
41
# File 'lib/pragma/decorator/association/adapter/base.rb', line 39

def full_object
  fail NotImplementedError
end

#primary_keyString|Integer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method is abstract.

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

Returns:

  • (String|Integer)

    the PK



30
31
32
# File 'lib/pragma/decorator/association/adapter/base.rb', line 30

def primary_key
  fail NotImplementedError
end