class ActiveRecall::LeitnerSystem
Constants
- DELAYS
Attributes
box[R]
current_time[R]
times_right[R]
times_wrong[R]
Public Class Methods
new(box:, times_right:, times_wrong:, current_time: Time.current)
click to toggle source
# File lib/active_recall/algorithms/leitner_system.rb, line 25 def initialize(box:, times_right:, times_wrong:, current_time: Time.current) @box = box @current_time = current_time @times_right = times_right @times_wrong = times_wrong end
right(box:, times_right:, times_wrong:, current_time: Time.current)
click to toggle source
# File lib/active_recall/algorithms/leitner_system.rb, line 7 def self.right(box:, times_right:, times_wrong:, current_time: Time.current) new( box: box, current_time: current_time, times_right: times_right, times_wrong: times_wrong ).right end
wrong(box:, times_right:, times_wrong:, current_time: Time.current)
click to toggle source
# File lib/active_recall/algorithms/leitner_system.rb, line 16 def self.wrong(box:, times_right:, times_wrong:, current_time: Time.current) new( box: box, current_time: current_time, times_right: times_right, times_wrong: times_wrong ).wrong end
Public Instance Methods
right()
click to toggle source
# File lib/active_recall/algorithms/leitner_system.rb, line 32 def right { box: box + 1, times_right: times_right + 1, times_wrong: times_wrong, last_reviewed: current_time, next_review: next_review } end
wrong()
click to toggle source
# File lib/active_recall/algorithms/leitner_system.rb, line 42 def wrong { box: 0, times_right: times_right, times_wrong: times_wrong + 1, last_reviewed: current_time, next_review: nil } end
Private Instance Methods
next_review()
click to toggle source
# File lib/active_recall/algorithms/leitner_system.rb, line 56 def next_review (current_time + DELAYS[[DELAYS.count, box + 1].min - 1].days) end