Class: FoodInfo::Adapters::FatSecret::Data::FoodItem
- Inherits:
-
Hashie::Trash
- Object
- Hashie::Trash
- FoodInfo::Adapters::FatSecret::Data::FoodItem
- Defined in:
- lib/food_info/adapters/fat_secret/data/food_item.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ FoodItem
constructor
A new instance of FoodItem.
Constructor Details
#initialize(*args) ⇒ FoodItem
Returns a new instance of FoodItem.
14 15 16 17 18 19 20 21 |
# File 'lib/food_info/adapters/fat_secret/data/food_item.rb', line 14 def initialize(*args) super(*args) # Can't use Array(), as that turns internals of the hash into array pairs as well serving_info = self[:servings]['serving'] serving_info = [serving_info] if serving_info.is_a?(Hash) self[:servings] = serving_info.collect{|s| FoodServing.new(s) } end |