Class: Lightrail::Wrapper::Associations::AssociationConfig
- Inherits:
-
Object
- Object
- Lightrail::Wrapper::Associations::AssociationConfig
- Defined in:
- lib/lightrail/wrapper/associations.rb
Overview
association
returns the name of the association in the wrapped object. key
returns the JSON key to store the association
id. as
is the name of the association
in the flat JSON. includes
is the name expected on the include.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#as ⇒ Object
readonly
Returns the value of attribute as.
-
#includes ⇒ Object
readonly
Returns the value of attribute includes.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, options) ⇒ AssociationConfig
constructor
A new instance of AssociationConfig.
-
#update(view, object) ⇒ Object
Receives a view and update it accordingly with the given object id and the association cardinality.
Constructor Details
#initialize(name, options) ⇒ AssociationConfig
Returns a new instance of AssociationConfig.
11 12 13 |
# File 'lib/lightrail/wrapper/associations.rb', line 11 def initialize(name, ) @name = name.to_sym end |
Instance Attribute Details
#as ⇒ Object (readonly)
Returns the value of attribute as.
9 10 11 |
# File 'lib/lightrail/wrapper/associations.rb', line 9 def as @as end |
#includes ⇒ Object (readonly)
Returns the value of attribute includes.
9 10 11 |
# File 'lib/lightrail/wrapper/associations.rb', line 9 def includes @includes end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/lightrail/wrapper/associations.rb', line 9 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/lightrail/wrapper/associations.rb', line 9 def name @name end |
Instance Method Details
#update(view, object) ⇒ Object
Receives a view and update it accordingly with the given object id and the association cardinality.
17 18 19 |
# File 'lib/lightrail/wrapper/associations.rb', line 17 def update(view, object) raise NotImplementedError end |