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 Base.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

Class Method 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



34
35
36
# File 'lib/pragma/decorator/association/adapter/base.rb', line 34

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.



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

def bond
  @bond
end

Class Method Details

.supports?(_model) ⇒ Boolean

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 whether the adapter supports the given model.

Parameters:

  • _model (Object)

    a model

Returns:

  • (Boolean)

    whether the adpater supports the model



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

def supports?(_model)
  fail NotImplementedError
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



52
53
54
# File 'lib/pragma/decorator/association/adapter/base.rb', line 52

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



43
44
45
# File 'lib/pragma/decorator/association/adapter/base.rb', line 43

def primary_key
  fail NotImplementedError
end