Class: AnkiRecord::DeckOptionsGroup

Inherits:
Object
  • Object
show all
Includes:
DeckOptionsGroupAttributes, Helpers::SharedConstantsHelper, Helpers::TimeHelper
Defined in:
lib/anki_record/deck_options_group/deck_options_group.rb

Overview

DeckOptionsGroup represents a set of options that can be applied to an Anki deck. The interface to this has not been explored much so using the gem with these directly may involve breaking encapsulation.

Instance Attribute Summary

Attributes included from DeckOptionsGroupAttributes

#anki21_database, #id, #last_modified_timestamp, #name

Instance Method Summary collapse

Methods included from Helpers::TimeHelper

#milliseconds_since_epoch, #seconds_since_epoch

Constructor Details

#initialize(anki21_database:, name: nil, args: nil) ⇒ DeckOptionsGroup

Instantiates a new deck options group belonging to anki21_database with name name.

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/anki_record/deck_options_group/deck_options_group.rb', line 19

def initialize(anki21_database:, name: nil, args: nil)
  raise ArgumentError unless (name && args.nil?) || (args && args["name"])

  @anki21_database = anki21_database

  if args
    setup_deck_options_group_instance_variables_from_existing(args:)
  else
    setup_deck_options_group_instance_variables(name:)
  end

  @anki21_database.add_deck_options_group self
end