Class: Copyleaks::SubmissionWritingFeedback

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/submissions/properties/writing_feedback.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enable = false, score = nil) ⇒ SubmissionWritingFeedback

Returns a new instance of SubmissionWritingFeedback.

Parameters:

  • Enable (Boolean)

    automated Writing Assistant . This feature includes grammar checking, spell checking and sentence structure corrections.

  • an (ScoreWeights)

    object containing the score weights for different writing aspects (e.g., grammar, mechanics). Optional.



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/copyleaks/models/submissions/properties/writing_feedback.rb', line 30

def initialize(enable = false, score = nil)
  unless [true, false].include?(enable)
      raise 'Copyleaks::SubmissionWritingFeedback - enable - enable must be of type Boolean'
  end
  unless score.nil? || score.is_a?(ScoreWeights)
      raise 'Copyleaks::SubmissionWritingFeedback - score - score must be of type ScoreWeights'
  end

  @enable = enable
  @score = score
end

Instance Attribute Details

#enableObject

Returns the value of attribute enable.



27
28
29
# File 'lib/copyleaks/models/submissions/properties/writing_feedback.rb', line 27

def enable
  @enable
end

#scoreObject

Returns the value of attribute score.



27
28
29
# File 'lib/copyleaks/models/submissions/properties/writing_feedback.rb', line 27

def score
  @score
end

Instance Method Details

#as_json(*_args) ⇒ Object



42
43
44
45
46
47
# File 'lib/copyleaks/models/submissions/properties/writing_feedback.rb', line 42

def as_json(*_args)
  {
    enable: @enable,
    score: @score
  }.reject { |_k, v| v.nil? }
end

#to_json(*options) ⇒ Object



49
50
51
# File 'lib/copyleaks/models/submissions/properties/writing_feedback.rb', line 49

def to_json(*options)
  as_json(*options).to_json(*options)
end