Class: SeriousEats::Recipe

Inherits:
Object
  • Object
show all
Defined in:
lib/serious-eats/recipe.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRecipe

Returns a new instance of Recipe.



17
18
19
# File 'lib/serious-eats/recipe.rb', line 17

def initialize
  @@all << self
end

Instance Attribute Details

#active_timeObject

Returns the value of attribute active_time.



9
10
11
# File 'lib/serious-eats/recipe.rb', line 9

def active_time
  @active_time
end

#categoryObject

Returns the value of attribute category.



5
6
7
# File 'lib/serious-eats/recipe.rb', line 5

def category
  @category
end

#descriptionObject

Returns the value of attribute description.



7
8
9
# File 'lib/serious-eats/recipe.rb', line 7

def description
  @description
end

#directionsObject

Returns the value of attribute directions.



13
14
15
# File 'lib/serious-eats/recipe.rb', line 13

def directions
  @directions
end

#ingredientsObject

Returns the value of attribute ingredients.



12
13
14
# File 'lib/serious-eats/recipe.rb', line 12

def ingredients
  @ingredients
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/serious-eats/recipe.rb', line 3

def name
  @name
end

#portionObject

Returns the value of attribute portion.



8
9
10
# File 'lib/serious-eats/recipe.rb', line 8

def portion
  @portion
end

#ratingObject

Returns the value of attribute rating.



11
12
13
# File 'lib/serious-eats/recipe.rb', line 11

def rating
  @rating
end

#total_timeObject

Returns the value of attribute total_time.



10
11
12
# File 'lib/serious-eats/recipe.rb', line 10

def total_time
  @total_time
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/serious-eats/recipe.rb', line 4

def url
  @url
end

Class Method Details

.allObject



21
22
23
# File 'lib/serious-eats/recipe.rb', line 21

def self.all
  @@all
end

.find(id) ⇒ Object



25
26
27
# File 'lib/serious-eats/recipe.rb', line 25

def self.find(id)
  self.all[id - 1]
end

Instance Method Details

#has_data?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/serious-eats/recipe.rb', line 29

def has_data?
  !!description
end