Class: Lightrail::Wrapper::Associations::AssociationConfig

Inherits:
Object
  • Object
show all
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

HasManyConfig, HasOneConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options)
  @name = name.to_sym
end

Instance Attribute Details

#asObject (readonly)

Returns the value of attribute as.



9
10
11
# File 'lib/lightrail/wrapper/associations.rb', line 9

def as
  @as
end

#includesObject (readonly)

Returns the value of attribute includes.



9
10
11
# File 'lib/lightrail/wrapper/associations.rb', line 9

def includes
  @includes
end

#keyObject (readonly)

Returns the value of attribute key.



9
10
11
# File 'lib/lightrail/wrapper/associations.rb', line 9

def key
  @key
end

#nameObject (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.

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/lightrail/wrapper/associations.rb', line 17

def update(view, object)
  raise NotImplementedError
end