Class: Nutriscore::Common::Score
- Inherits:
-
Object
- Object
- Nutriscore::Common::Score
- Defined in:
- lib/nutriscore/common/score.rb
Direct Known Subclasses
FR::DrinksScore, FR::FatsScore, FR::NegativeScore, FR::PositiveScore, UK::NegativeScore, UK::PositiveScore
Instance Attribute Summary collapse
-
#nutrients ⇒ Object
readonly
Returns the value of attribute nutrients.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(nutrients) ⇒ Score
constructor
A new instance of Score.
- #inspect ⇒ Object
- #score ⇒ Object
Constructor Details
Instance Attribute Details
#nutrients ⇒ Object (readonly)
Returns the value of attribute nutrients.
7 8 9 |
# File 'lib/nutriscore/common/score.rb', line 7 def nutrients @nutrients end |
Class Method Details
.nutrient_keys ⇒ Object
9 10 11 |
# File 'lib/nutriscore/common/score.rb', line 9 def self.nutrient_keys [] end |
Instance Method Details
#inspect ⇒ Object
21 22 23 |
# File 'lib/nutriscore/common/score.rb', line 21 def inspect "#<#{self.class} score=#{score} #{inspect_nutrients}>" end |
#score ⇒ Object
13 14 15 |
# File 'lib/nutriscore/common/score.rb', line 13 def score self.class.nutrient_keys.map(&method(:public_send)).reduce(&:+) end |