Class: ActiveRecall::FSRS::Internal::CardScheduler
- Inherits:
-
Object
- Object
- ActiveRecall::FSRS::Internal::CardScheduler
- Defined in:
- lib/active_recall/algorithms/fsrs/internal.rb
Instance Attribute Summary collapse
-
#again ⇒ Object
Returns the value of attribute again.
-
#easy ⇒ Object
Returns the value of attribute easy.
-
#good ⇒ Object
Returns the value of attribute good.
-
#hard ⇒ Object
Returns the value of attribute hard.
Instance Method Summary collapse
-
#initialize(card) ⇒ CardScheduler
constructor
A new instance of CardScheduler.
- #record_log(card, now) ⇒ Object
- #schedule(now, hard_interval, good_interval, easy_interval) ⇒ Object
- #update_state(state) ⇒ Object
Constructor Details
#initialize(card) ⇒ CardScheduler
Returns a new instance of CardScheduler.
96 97 98 99 100 101 |
# File 'lib/active_recall/algorithms/fsrs/internal.rb', line 96 def initialize(card) @again = card.clone @hard = card.clone @good = card.clone @easy = card.clone end |
Instance Attribute Details
#again ⇒ Object
Returns the value of attribute again.
94 95 96 |
# File 'lib/active_recall/algorithms/fsrs/internal.rb', line 94 def again @again end |
#easy ⇒ Object
Returns the value of attribute easy.
94 95 96 |
# File 'lib/active_recall/algorithms/fsrs/internal.rb', line 94 def easy @easy end |
#good ⇒ Object
Returns the value of attribute good.
94 95 96 |
# File 'lib/active_recall/algorithms/fsrs/internal.rb', line 94 def good @good end |
#hard ⇒ Object
Returns the value of attribute hard.
94 95 96 |
# File 'lib/active_recall/algorithms/fsrs/internal.rb', line 94 def hard @hard end |
Instance Method Details
#record_log(card, now) ⇒ Object
119 120 121 122 123 124 125 126 |
# File 'lib/active_recall/algorithms/fsrs/internal.rb', line 119 def record_log(card, now) { Rating::AGAIN => record_again_log(card, now), Rating::HARD => record_hard_log(card, now), Rating::GOOD => record_good_log(card, now), Rating::EASY => record_easy_log(card, now) } end |
#schedule(now, hard_interval, good_interval, easy_interval) ⇒ Object
114 115 116 117 |
# File 'lib/active_recall/algorithms/fsrs/internal.rb', line 114 def schedule(now, hard_interval, good_interval, easy_interval) update_schedule_days(hard_interval, good_interval, easy_interval) update_due_dates(now, hard_interval, good_interval, easy_interval) end |
#update_state(state) ⇒ Object
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/active_recall/algorithms/fsrs/internal.rb', line 103 def update_state(state) case state when State::NEW update_new_state when State::LEARNING, State::RELEARNING update_learning_relearning_state(state) when State::REVIEW update_review_state end end |