class Anki::Importer::Model

Schema for Anki cards.

A deck can have multiple models.

Attributes

anki_id[R]

Unique ID in the models table.

card_models[R]

Schema for cards based off this model.

description[R]

Generally empty.

facts[R]

Facts implementing this model.

fields[R]

Fields belonging to this model.

name[R]

Name assigned in the Anki UI.

tags[R]

Assigned in the Anki UI. Space-separated string.

Public Class Methods

from_db(deck_db) click to toggle source

Reads the models from an Anki deck.

Args:

deck_db:: a Sqlite3::Datbase

Returns an array of Model instances.

# File lib/anki/importer/model.rb, line 34
def self.from_db(deck_db)
  query = 'SELECT id, name, description, tags, features FROM models'
  models = deck_db.execute(query).map do |anki_id, name, description, tags,
                                          features|
    self.new anki_id, name, description, tags, features
  end
end