Skip to content
Browse files

fix parser so it matches drink_as_data

  • Loading branch information...
1 parent 7ca51c4 commit 054a9e58fe17d360f59385f08d69be6591c7e094 @frioux committed Oct 12, 2012
Showing with 6 additions and 6 deletions.
  1. +2 −2 lib/DU/RecipeParser.pm
  2. +4 −4 t/parser.t
View
4 lib/DU/RecipeParser.pm
@@ -93,7 +93,7 @@ sub encode_recipe {
for my $i (@{$_[0]->{ingredients}}) {
$ingredients .= " * $i->{amount} " . PL($i->{unit}, $i->{amount})
- . " of $i->{ingredient}\n";
+ . " of $i->{name}\n";
$ingredients .= " # $i->{note}\n" if $i->{note};
}
@@ -141,7 +141,7 @@ sub got_ingredients {
map +{
amount => 0 + $_->[0],
unit => $_->[1],
- ingredient => $_->[2],
+ name => $_->[2],
($_->[3] ? (note => $_->[3]) : ()),
}, @{$_[1]}
];
View
8 t/parser.t
@@ -29,20 +29,20 @@ my $expected = {
description => "This is a delicious beverage for a hot day.\nRefreshing.\n\nDrink it at a wedding.\n",
ingredients => [{
amount => 4,
- ingredient => "Club Soda",
+ name => "Club Soda",
unit => "ounce"
}, {
amount => 2,
- ingredient => "Gin",
+ name => "Gin",
unit => "ounce"
}, {
amount => 1,
- ingredient => "Lemon Juice",
+ name => "Lemon Juice",
note => "fresh is good",
unit => "ounce"
}, {
amount => 1,
- ingredient => "Simple Syrup",
+ name => "Simple Syrup",
unit => "tablespoon"
}],
name => "Tom Collins",

0 comments on commit 054a9e5

Please sign in to comment.
Something went wrong with that request. Please try again.