class Anki::Card
Attributes
deck[RW]
id[R]
Public Class Methods
new(options={})
click to toggle source
# File lib/ankirb/anki/card.rb, line 6 def initialize options={} @front = CardFace.new(options[:front] || '') @back = CardFace.new(options[:back] || '') @tags = options[:tags] || [] @id = Anki::Helper.get_id end
Public Instance Methods
back()
click to toggle source
# File lib/ankirb/anki/card.rb, line 18 def back @back end
Also aliased as: answer
back=(value)
click to toggle source
# File lib/ankirb/anki/card.rb, line 48 def back= value if value.is_a? String @back.content = value else @back = value end end
Also aliased as: answer=
front()
click to toggle source
# File lib/ankirb/anki/card.rb, line 14 def front @front end
Also aliased as: question
front=(value)
click to toggle source
# File lib/ankirb/anki/card.rb, line 40 def front= value if value.is_a? String @front.content = value else @front = value end end
Also aliased as: question=
has_media?()
click to toggle source
is media attached to this card?
# File lib/ankirb/anki/card.rb, line 36 def has_media? !@front.media.empty? or !back.media.empty? end
initialize_copy(orig)
click to toggle source
Calls superclass method
# File lib/ankirb/anki/card.rb, line 56 def initialize_copy orig super @front = Marshal.load(Marshal.dump(orig.front)) @back = Marshal.load(Marshal.dump(orig.back)) end
invert()
click to toggle source
returns a new card with the front and back of the original inverted
# File lib/ankirb/anki/card.rb, line 23 def invert c = Anki::Card.new(front: @back.to_s, back: @front.to_s) c.front = @back.dup c.back = @front.dup c end
invert!()
click to toggle source
flips the front and back of this card
# File lib/ankirb/anki/card.rb, line 31 def invert! @front, @back = @back, @front end