parsley/app/models/ingredient_proxy.rb

25 lines
326 B
Ruby
Raw Normal View History

2018-08-27 16:44:45 -05:00
class IngredientProxy
attr_reader :ingredient
2018-09-11 10:38:07 -05:00
def initialize(food)
@food = food
2018-08-27 16:44:45 -05:00
end
def name
2018-09-11 10:38:07 -05:00
@food.name
2018-08-27 16:44:45 -05:00
end
def density
2018-09-11 10:38:07 -05:00
@food.density
2018-08-27 16:44:45 -05:00
end
def density?
2018-09-11 10:38:07 -05:00
@food.density.present?
2018-08-27 16:44:45 -05:00
end
def get_custom_unit_equivalent(custom_unit_name)
2018-09-11 10:38:07 -05:00
@food.custom_unit_weight(custom_unit_name)
2018-08-27 16:44:45 -05:00
end
end