Class: Lotus::Model::Mapping::Coercer Private

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

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



17
18
19
20
# File 'lib/lotus/model/mapping/coercer.rb', line 17

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



41
42
# File 'lib/lotus/model/mapping/coercer.rb', line 41

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



30
31
# File 'lib/lotus/model/mapping/coercer.rb', line 30

def to_record(entity)
end