Skip to Content Skip to Search

NoteField represents a field of an Anki note type

Methods
N
Included Modules

Class Public methods

new(note_type:, name: nil, args: nil)

Instantiates a new field for the note type note_type with name name.

# File lib/anki_record/note_field/note_field.rb, line 15
def initialize(note_type:, name: nil, args: nil)
  raise ArgumentError unless (name && args.nil?) || (args && args["name"])

  @note_type = note_type
  if args
    setup_note_field_instance_variables_from_existing(args:)
  else
    setup_note_field_instance_variables_for_new_field(name:)
  end

  @note_type.add_note_field self
end