Class: SpacedRepetition::Sm2
- Inherits:
-
Object
- Object
- SpacedRepetition::Sm2
- Defined in:
- lib/spaced_repetition/sm2.rb
Instance Method Summary collapse
- #easiness_factor ⇒ Object
-
#initialize(quality_response, prev_interval = 0, prev_ef = 2.5) ⇒ Sm2
constructor
A new instance of Sm2.
- #interval ⇒ Object
- #next_repetition_date ⇒ Object
Constructor Details
#initialize(quality_response, prev_interval = 0, prev_ef = 2.5) ⇒ Sm2
Returns a new instance of Sm2.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/spaced_repetition/sm2.rb', line 6 def initialize(quality_response, prev_interval=0, prev_ef=2.5) @prev_ef = prev_ef @prev_interval = prev_interval @quality_response = quality_response @calculated_interval = nil @calculated_ef = nil @repetition_date = nil #if quality_response is below 3 start repetition from the begining, but without changing easiness_factor if @quality_response < 3 @prev_interval=0 @calculated_ef = @prev_ef else calculate_easiness_factor end calculate_interval calculate_date end |
Instance Method Details
#easiness_factor ⇒ Object
31 32 33 |
# File 'lib/spaced_repetition/sm2.rb', line 31 def easiness_factor @calculated_ef end |
#interval ⇒ Object
27 28 29 |
# File 'lib/spaced_repetition/sm2.rb', line 27 def interval @calculated_interval end |
#next_repetition_date ⇒ Object
35 36 37 |
# File 'lib/spaced_repetition/sm2.rb', line 35 def next_repetition_date @repetition_date end |