Class: ActiveRecall::FibonacciSequence
- Inherits:
-
Object
- Object
- ActiveRecall::FibonacciSequence
- Defined in:
- lib/active_recall/algorithms/fibonacci_sequence.rb
Class Method Summary collapse
- .right(box:, times_right:, times_wrong:, current_time: Time.current) ⇒ Object
- .wrong(box:, times_right:, times_wrong:, current_time: Time.current) ⇒ Object
Instance Method Summary collapse
-
#initialize(box:, times_right:, times_wrong:, current_time: Time.current) ⇒ FibonacciSequence
constructor
A new instance of FibonacciSequence.
- #right ⇒ Object
- #wrong ⇒ Object
Constructor Details
#initialize(box:, times_right:, times_wrong:, current_time: Time.current) ⇒ FibonacciSequence
Returns a new instance of FibonacciSequence.
23 24 25 26 27 28 |
# File 'lib/active_recall/algorithms/fibonacci_sequence.rb', line 23 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 |
Class Method Details
.right(box:, times_right:, times_wrong:, current_time: Time.current) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/active_recall/algorithms/fibonacci_sequence.rb', line 5 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) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/active_recall/algorithms/fibonacci_sequence.rb', line 14 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 |
Instance Method Details
#right ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/active_recall/algorithms/fibonacci_sequence.rb', line 30 def right { box: box + 1, last_reviewed: current_time, next_review: next_review, times_right: times_right + 1, times_wrong: times_wrong } end |
#wrong ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/active_recall/algorithms/fibonacci_sequence.rb', line 40 def wrong { box: [0, box - 1].max, last_reviewed: current_time, next_review: nil, times_right: times_right, times_wrong: times_wrong + 1 } end |