parsley/app/models/concerns/ingredient.rb

24 lines
560 B
Ruby

# Mixin for Ingredient-like things.
# Consumer is expected to have the following methods:
# #name => name of ingredient
# #density => valid density string or nil
# #custom_units => map of unit names to a weight (eg { 'clove' => '25 g', 'bulb' => '175 g' })
# #nutrition_per_100g => Object that responds to all nutrition keys in NutritionData
# nutrition_per_100g_errors => list of errors
module Ingredient
extend ActiveSupport::Concern
included do
end
# Shared helper methods
def density?
!density.nil?
end
module ClassMethods
end
end