Class: TopRecipes::Recipe

Inherits:
Object
  • Object
show all
Defined in:
lib/top_recipes/recipe.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Recipe

Returns a new instance of Recipe.



8
9
10
11
# File 'lib/top_recipes/recipe.rb', line 8

def initialize(name)
  @name = name
  @@all << self
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



3
4
5
# File 'lib/top_recipes/recipe.rb', line 3

def author
  @author
end

#directionsObject

Returns the value of attribute directions.



3
4
5
# File 'lib/top_recipes/recipe.rb', line 3

def directions
  @directions
end

#ingredientsObject

Returns the value of attribute ingredients.



3
4
5
# File 'lib/top_recipes/recipe.rb', line 3

def ingredients
  @ingredients
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/top_recipes/recipe.rb', line 4

def name
  @name
end

#ratingObject

Returns the value of attribute rating.



3
4
5
# File 'lib/top_recipes/recipe.rb', line 3

def rating
  @rating
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/top_recipes/recipe.rb', line 3

def url
  @url
end

Class Method Details

.top_recipesObject



13
14
15
# File 'lib/top_recipes/recipe.rb', line 13

def self.top_recipes
  @@all
end