Class: BudgetBytesCli::Recipe
- Inherits:
-
Object
- Object
- BudgetBytesCli::Recipe
- Defined in:
- lib/budget_bytes_cli/recipe.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #ingredients ⇒ Object
-
#initialize(url = nil, name = nil) ⇒ Recipe
constructor
A new instance of Recipe.
- #instructions ⇒ Object
Constructor Details
#initialize(url = nil, name = nil) ⇒ Recipe
Returns a new instance of Recipe.
4 5 6 7 |
# File 'lib/budget_bytes_cli/recipe.rb', line 4 def initialize(url = nil, name = nil) @name = name @url = url end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/budget_bytes_cli/recipe.rb', line 2 def name @name end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
2 3 4 |
# File 'lib/budget_bytes_cli/recipe.rb', line 2 def url @url end |
Instance Method Details
#ingredients ⇒ Object
9 10 11 12 13 14 |
# File 'lib/budget_bytes_cli/recipe.rb', line 9 def ingredients unless @ingredients @ingredients, @instructions = BudgetBytesCli::Scraper.scrape_recipe(@url) end @ingredients end |
#instructions ⇒ Object
16 17 18 19 20 21 |
# File 'lib/budget_bytes_cli/recipe.rb', line 16 def instructions unless @instructions @ingredients, @instructions = BudgetBytesCli::Scraper.scrape_recipe(@url) end @instructions end |