Class: BudgetBytesCli::Recipe

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/budget_bytes_cli/recipe.rb', line 2

def name
  @name
end

#urlObject (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

#ingredientsObject



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

#instructionsObject



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