Sha256: 7794e1142fd25ec06fa94c64e1e9bc54104be8759525434366b0259844ff3d05
Contents?: true
Size: 854 Bytes
Versions: 1
Compression:
Stored size: 854 Bytes
Contents
class TodaysTopDesserts::Recipe attr_accessor :name, :author, :description, :serving_size, :prep_time, :cook_time, :ready_time, :calorie_count, :ingredients, :instructions, :url @@all = [] def initialize(recipe_hash) #initializes new recipe with a hash of attributes recipe_hash.each {|key, value| self.send(("#{key}="), value)} @@all << self end def self.create_from_collection(recipes_array) #creates new recipes from an array of hashes that include recipe attributes recipes_array.each do |hash| TodaysTopDesserts::Recipe.new(hash) end end def add_recipe_attributes(attributes_hash) #adds attributes to existing recipes attributes_hash.each {|key, value| self.send(("#{key}="), value)} self end def self.today #returns all instances of TodaysTopDesserts::Recipe @@all end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
todays_top_desserts-0.1.1 | lib/todays_top_desserts/recipe.rb |