Class: Rasti::DB::TypeConverters::SQLite

Inherits:
Object
  • Object
show all
Defined in:
lib/rasti/db/type_converters/sqlite.rb

Constant Summary collapse

CONVERTERS =
[SQLiteTypes::Array]

Class Method Summary collapse

Class Method Details

.from_db(object) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/rasti/db/type_converters/sqlite.rb', line 22

def from_db(object)
  converter = find_converter_from_db object
  if !converter.nil?
    converter.from_db object
  else
    object
  end
end

.to_db(db, collection_name, attribute_name, value) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/rasti/db/type_converters/sqlite.rb', line 12

def to_db(db, collection_name, attribute_name, value)
  to_db_mapping = to_db_mapping_for db, collection_name

  if to_db_mapping.key? attribute_name
    to_db_mapping[attribute_name][:converter].to_db value
  else
    value
  end
end