# File lib/tablecloth/recipe.rb, line 7 def initialize *args @method = [] @ingredients = Ingredients.new #nothing left to do if no args passed in return if args.size == 0 #couple of syntax checks params = args.first raise ArgumentError if params.empty? || params.class != Hash parse_ingredients params[:ingredients] end
add ingredients straight into tablecloth instance
# File lib/tablecloth/recipe.rb, line 24 def parse_ingredients ingredients return if ingredients.nil? #units_hash = YAML.load_file("lib/tablecloth/yaml/qty.yaml") units_hash = YAML.load_file(File.join(File.dirname(__FILE__),"yaml/qty.yaml")) ingredients.each_line do |line| @ingredients << TableCloth::Ingredient.parse(line, units_hash) end end