class Reminder
Attributes
answer[R]
due_on[R]
history[R]
question[R]
Public Class Methods
new(question, answer, due_on=Date.today, history=[])
click to toggle source
# File lib/forgetful/reminder.rb, line 4 def initialize(question, answer, due_on=Date.today, history=[]) @question = question @answer = answer @due_on = due_on @history = history.dup.freeze end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/forgetful/reminder.rb, line 24 def <=>(other) to_a <=> other.to_a end
ef()
click to toggle source
# File lib/forgetful/reminder.rb, line 11 def ef SuperMemo::traverse(history)[0] end
next(q)
click to toggle source
# File lib/forgetful/reminder.rb, line 15 def next(q) new_history = history + [q] Reminder.new(question, answer, SuperMemo::next_date(Date.today, new_history), new_history) end
review?()
click to toggle source
# File lib/forgetful/reminder.rb, line 28 def review? history.empty? || history.last < 4 end
to_a()
click to toggle source
# File lib/forgetful/reminder.rb, line 20 def to_a [question, answer, due_on, history] end
to_csv()
click to toggle source
# File lib/forgetful/extensions/csv/reminder.rb, line 10 def to_csv if history.empty? [question, answer, due_on.to_s] else [question, answer, due_on.to_s, history.join] end end