Class: Copyleaks::NewResultScore

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aggregatedScore:) ⇒ NewResultScore

Returns a new instance of NewResultScore.

Parameters:

  • aggregatedScore (Float)
    • The percentage of similar words from all results. The calculation does not include excluded references, quotations, etc…



26
27
28
29
30
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb', line 26

def initialize(aggregatedScore:)
  raise 'Copyleaks::NewResultScore - aggregatedScore must be a Float' unless aggregatedScore.is_a?(Float) || aggregatedScore.is_a?(Integer)
  
  @aggregatedScore = aggregatedScore.to_f
end

Instance Attribute Details

#aggregatedScoreObject (readonly)

Returns the value of attribute aggregatedScore.



23
24
25
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb', line 23

def aggregatedScore
  @aggregatedScore
end

Instance Method Details

#as_json(*_args) ⇒ Object



32
33
34
35
36
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb', line 32

def as_json(*_args)
  {
    aggregatedScore: @aggregatedScore
  }
end

#to_json(*options) ⇒ Object



38
39
40
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/NewResultsModels/NewResultScore.rb', line 38

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