Class: Nutriscore::UK::SpecificScore
- Inherits:
-
GeneralScore
- Object
- GeneralScore
- Nutriscore::UK::SpecificScore
- Defined in:
- lib/nutriscore/uk/specific_score.rb
Overview
this is for general products
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from GeneralScore
Instance Method Summary collapse
Methods inherited from GeneralScore
#initialize, #inspect, nutrient_keys
Methods included from GeneralLessHealthy
Constructor Details
This class inherits a constructor from Nutriscore::UK::GeneralScore
Instance Method Details
#score ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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, nuts and pulses.' if @negative.score.min < 11 || @positive.fvnp.max >= 5 @negative.score - @positive.score elsif @negative.score.max >= 11 && @positive.fvnp.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 |