Class: ActiveNutrition::Objects::Food
- Defined in:
- lib/active_nutrition/objects/food.rb
Constant Summary collapse
- METHOD_MAP =
{ :name => :Long_Desc, :ndb_number => :NDB_No, :common_name => :ComName, :manufacturers_name => :ManufacName, :survey => :Survey, :scientific_name => :SciName, :fat_factor => :Fat_Factor, :protein_factor => :Pro_Factor }
Instance Attribute Summary collapse
-
#food_group ⇒ Object
readonly
Returns the value of attribute food_group.
-
#nutrition_facts ⇒ Object
readonly
Returns the value of attribute nutrition_facts.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from ActiveNutrition::Objects::Base
Instance Attribute Details
#food_group ⇒ Object (readonly)
Returns the value of attribute food_group.
19 20 21 |
# File 'lib/active_nutrition/objects/food.rb', line 19 def food_group @food_group end |
#nutrition_facts ⇒ Object (readonly)
Returns the value of attribute nutrition_facts.
19 20 21 |
# File 'lib/active_nutrition/objects/food.rb', line 19 def nutrition_facts @nutrition_facts end |
Instance Method Details
#factors ⇒ Object
33 34 35 36 37 38 |
# File 'lib/active_nutrition/objects/food.rb', line 33 def factors [:fat_factor, :protein_factor].inject({}) do |ret, factor| ret[factor] = attributes[METHOD_MAP[factor].to_s] ret end end |