Class: Fsrs::SchedulingInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/fsrs/fsrs.rb

Overview

Scheduling Info

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(card, review_log) ⇒ SchedulingInfo

Returns a new instance of SchedulingInfo.



9
10
11
12
# File 'lib/fsrs/fsrs.rb', line 9

def initialize(card, review_log)
  @card = card
  @review_log = review_log
end

Instance Attribute Details

#cardObject

Returns the value of attribute card.



7
8
9
# File 'lib/fsrs/fsrs.rb', line 7

def card
  @card
end

#review_logObject

Returns the value of attribute review_log.



7
8
9
# File 'lib/fsrs/fsrs.rb', line 7

def review_log
  @review_log
end

Class Method Details

.from_h(hash) ⇒ Object



21
22
23
24
25
26
# File 'lib/fsrs/fsrs.rb', line 21

def self.from_h(hash)
  new(
    Fsrs::Card.from_h(hash[:card]),
    Fsrs::ReviewLog.from_h(hash[:review_log])
  )
end

Instance Method Details

#to_hObject



14
15
16
17
18
19
# File 'lib/fsrs/fsrs.rb', line 14

def to_h
  {
    card: @card.to_h,
    review_log: @review_log.to_h
  }
end