class Anki::Importer::Deck
The root of the Anki
object graph.
Attributes
card_models[R]
All the card models (schemas for cards) in the deck.
facts[R]
All the facts (associations) in the deck.
fields[R]
All the fields (fact schema elements) in the deck.
models[R]
All the models in the deck.
Public Class Methods
from_db(deck_db)
click to toggle source
Reads an Anki
deck database.
Args:
deck_db:: a Sqlite3::Datbase
Returns a deck.
# File lib/anki/importer/deck.rb, line 34 def self.from_db(deck_db) deck = self.new deck.models = Model.from_db deck_db deck.fields = Field.from_db deck_db, deck deck.fields.each { |field| field.model.add_field field } deck.card_models = CardModel.from_db deck_db, deck deck.card_models.each { |cmodel| cmodel.model.add_card_model cmodel } deck.facts = Fact.from_db deck_db, deck deck.facts.each { |fact| fact.model.add_fact fact } deck end
from_file(deck_path)
click to toggle source
Reads an Anki
deck database.
Args:
deck_path:: path to an Anki deck on the filesystem
Returns a deck.
# File lib/anki/importer/deck.rb, line 23 def self.from_file(deck_path) deck_db = SQLite3::Database.new deck_path from_db deck_db end