Class: Pragma::Decorator::Association::Adapter::Poro Private
- Includes:
- Adaptor
- Defined in:
- lib/pragma/decorator/association/adapter/poro.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 is the fallback adapter that is used when no other adpater is compatible with a model. It simply calls #id on the associated object to get the PK and returns the associated object itself when expanding.
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.supports?(_model) ⇒ Boolean
private
Returns whether the adapter supports the model.
Instance Method Summary collapse
-
#full_object ⇒ Object
private
Returns the expanded associated object.
-
#primary_key ⇒ Integer|String|NilClass
private
Returns the PK of the associated object.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Pragma::Decorator::Association::Adapter::Base
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.
Returns whether the adapter supports the model.
Since this is the default adapter, this always returns true.
23 24 25 |
# File 'lib/pragma/decorator/association/adapter/poro.rb', line 23 def supports?(_model) true end |
Instance Method Details
#full_object ⇒ Object
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.
Returns the expanded associated object.
This adapter simply returns the associated object itself.
43 44 45 |
# File 'lib/pragma/decorator/association/adapter/poro.rb', line 43 def full_object associated_object end |
#primary_key ⇒ Integer|String|NilClass
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.
Returns the PK of the associated object.
This adapter simply calls #id on the associated object or returns nil if there is no associated object.
34 35 36 |
# File 'lib/pragma/decorator/association/adapter/poro.rb', line 34 def primary_key associated_object&.id end |