Class: Fsrs::ReviewLog

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

Overview

Review Log

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rating, scheduled_days, elapsed_days, review, state) ⇒ ReviewLog

Returns a new instance of ReviewLog.



34
35
36
37
38
39
40
# File 'lib/fsrs/fsrs.rb', line 34

def initialize(rating, scheduled_days, elapsed_days, review, state)
  @rating = rating
  @scheduled_days = scheduled_days
  @elapsed_days = elapsed_days
  @review = review
  @state = state
end

Instance Attribute Details

#elapsed_daysObject

Returns the value of attribute elapsed_days.



32
33
34
# File 'lib/fsrs/fsrs.rb', line 32

def elapsed_days
  @elapsed_days
end

#ratingObject

Returns the value of attribute rating.



32
33
34
# File 'lib/fsrs/fsrs.rb', line 32

def rating
  @rating
end

#reviewObject

Returns the value of attribute review.



32
33
34
# File 'lib/fsrs/fsrs.rb', line 32

def review
  @review
end

#scheduled_daysObject

Returns the value of attribute scheduled_days.



32
33
34
# File 'lib/fsrs/fsrs.rb', line 32

def scheduled_days
  @scheduled_days
end

#stateObject

Returns the value of attribute state.



32
33
34
# File 'lib/fsrs/fsrs.rb', line 32

def state
  @state
end

Class Method Details

.from_h(hash) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'lib/fsrs/fsrs.rb', line 52

def self.from_h(hash)
  new(
    hash[:rating],
    hash[:scheduled_days],
    hash[:elapsed_days],
    hash[:review],
    hash[:state]
  )
end

Instance Method Details

#to_hObject



42
43
44
45
46
47
48
49
50
# File 'lib/fsrs/fsrs.rb', line 42

def to_h
  {
    rating: @rating,
    scheduled_days: @scheduled_days,
    elapsed_days: @elapsed_days,
    review: @review,
    state: @state
  }
end