Sha256: 10523c9c61eef55f964f8ea446f19a5d141227198b0e4423b452aaab68ded70f
Contents?: true
Size: 863 Bytes
Versions: 1
Compression:
Stored size: 863 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| recipe = 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.0 | lib/todays_top_desserts/recipe.rb |