class NutritionDataDecorator < BaseDecorator

  def format_number(n)
    '%.1f' % n
  end

  NutritionData::NUTRIENTS.keys.each do |m|

    define_method m do
      format_number(super())
    end

    define_method "#{m}_per" do |per|
      format_number(wrapped.send(m) / per)
    end

  end

end