class Nutriscore::FR::SpecificScore

this is for general products

Public Instance Methods

score() click to toggle source
# File lib/nutriscore/fr/specific_score.rb, line 8
def score
  if @negative.score.min < 11 || @positive.fruits_vegetables_nuts.max >= 5
    @negative.score - @positive.score
  elsif @negative.score.max >= 11 && @positive.fruits_vegetables_nuts.min < 5
    @negative.score - @positive.score_without_proteins
  else
    Range.new(
      @negative.score.min - @positive.score.max,
      @negative.score.max - @positive.score_without_proteins.min
    )
  end
end