Class: Lotus::Model::Mapping::CollectionCoercer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/lotus/model/mapping/collection_coercer.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.

Translates values from/to the database with the corresponding Ruby type.

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(collection) ⇒ CollectionCoercer

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.

Initialize a coercer for the given collection.

Parameters:

Since:

  • 0.1.0



15
16
17
18
# File 'lib/lotus/model/mapping/collection_coercer.rb', line 15

def initialize(collection)
  @collection = collection
  _compile!
end

Instance Method Details

#from_record(record) ⇒ 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.

Translates the given record into a Ruby object.

Parameters:

  • record (Hash)

Returns:

  • (Object)

Since:

  • 0.1.0



39
40
# File 'lib/lotus/model/mapping/collection_coercer.rb', line 39

def from_record(record)
end

#to_record(entity) ⇒ Hash

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.

Translates the given entity into a format compatible with the database.

Parameters:

  • entity (Object)

    the entity

Returns:

  • (Hash)

Since:

  • 0.1.0



28
29
# File 'lib/lotus/model/mapping/collection_coercer.rb', line 28

def to_record(entity)
end