Class: Nutriscore::FR::FatsScore

Inherits:
Common::Score show all
Includes:
GeneralScoreClass
Defined in:
lib/nutriscore/fr/fats_score.rb

Overview

this is for vegetable and animal fats and oils

Instance Attribute Summary

Attributes inherited from Common::Score

#nutrients

Class Method Summary collapse

Instance Method Summary collapse

Methods included from GeneralScoreClass

#score_class

Methods inherited from Common::Score

#initialize, #inspect

Constructor Details

This class inherits a constructor from Nutriscore::Common::Score

Class Method Details

.nutrient_keysObject



10
11
12
# File 'lib/nutriscore/fr/fats_score.rb', line 10

def self.nutrient_keys
  [:fat_saturated, :fat_total]
end

Instance Method Details

#fat_saturatedObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/nutriscore/fr/fats_score.rb', line 18

def fat_saturated
  score_value(fat_saturated_pct, 0..10) do |v|
    if    v < 10 then  0
    elsif v < 16 then  1
    elsif v < 22 then  2
    elsif v < 28 then  3
    elsif v < 34 then  4
    elsif v < 40 then  5
    elsif v < 46 then  6
    elsif v < 52 then  7
    elsif v < 58 then  8
    elsif v < 64 then  9
    else              10
    end
  end
end

#scoreObject



14
15
16
# File 'lib/nutriscore/fr/fats_score.rb', line 14

def score
  fat_saturated
end