class Nutriscore::UK::SpecificScore
this is for general products
Public Instance Methods
score()
click to toggle source
# File lib/nutriscore/uk/specific_score.rb, line 8 def score # 'If a food or drink scores 11 or more ‘A’ points then it cannot score points for protein # unless it also scores 5 points for fruit, vegetables and nuts.' 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