/***
 * Excerpted from "iOS SDK Development",
 * published by The Pragmatic Bookshelf.
 * Copyrights apply to this code. It may not be used to create training material, 
 * courses, books, articles, and the like. Contact us if you are in doubt.
 * We make no guarantees that this code is fit for any purpose. 
 * Visit http://www.pragmaticprogrammer.com/titles/adios for more book information.
***/
//
//  PRPRecipe.m
//  DocumentRecipes
//
//  Created by Bill Dudney on 6/29/11.
//  Copyright 2011 Gala Factory Software LLC. All rights reserved.
//

#import "PRPRecipe.h"

@implementation PRPRecipe

- (id)init {
    self = [super init];
    if (self) {
      self.title = @"New Recipe";
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)coder {
  self = [super init];
  if (self) {
    self.title = [coder decodeObjectForKey:@"title"];
    self.directions = [coder decodeObjectForKey:@"directions"];
    self.preparationTime = [coder decodeObjectForKey:@"preparationTime"];
    self.image = [coder decodeObjectForKey:@"image"];
    self.thumbnailImage = [coder decodeObjectForKey:@"thumbnailImage"];
  }
  return self;
}

- (void)encodeWithCoder:(NSCoder *)coder {
  [coder encodeObject:self.title forKey:@"title"];
  [coder encodeObject:self.directions forKey:@"directions"];
  [coder encodeObject:self.preparationTime forKey:@"preparationTime"];
  [coder encodeObject:self.image forKey:@"image"];
  [coder encodeObject:self.thumbnailImage forKey:@"thumbnailImage"];
}

/* We deliberately corrupt the title property in the testing chapter to see what
 it looks like when a test fails.
//
-(NSString*) title {
  return NSLocalizedString(@"Onion Rings", nil);
}
//
*/


@end
