Class: RecipeScrapers::Models::IngredientGroup

Inherits:
Data
  • Object
show all
Defined in:
lib/recipe_scrapers/models/ingredient_group.rb

Overview

The ingredients under one heading of the page. Recipe#ingredient_groups holds these.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(purpose:, ingredients:, parsed_ingredients: nil) ⇒ IngredientGroup

Returns a new instance of IngredientGroup.



15
16
17
# File 'lib/recipe_scrapers/models/ingredient_group.rb', line 15

def initialize(purpose:, ingredients:, parsed_ingredients: nil)
  super
end

Instance Attribute Details

#ingredients ⇒ Array<String> (readonly)

Returns the ingredient lines of the group.

Returns:

  • (Array<String>) —

    the ingredient lines of the group



14
15
16
17
18
# File 'lib/recipe_scrapers/models/ingredient_group.rb', line 14

IngredientGroup = Data.define(:purpose, :ingredients, :parsed_ingredients) do
  def initialize(purpose:, ingredients:, parsed_ingredients: nil)
    super
  end
end

#parsed_ingredients ⇒ Array<Models::Ingredient>? (readonly)

Returns the same lines split into an amount, a unit and a name, in the same order.

Returns:

  • (Array<Models::Ingredient>, nil) —

    the same lines split into an amount, a unit and a name, in the same order



14
15
16
17
18
# File 'lib/recipe_scrapers/models/ingredient_group.rb', line 14

IngredientGroup = Data.define(:purpose, :ingredients, :parsed_ingredients) do
  def initialize(purpose:, ingredients:, parsed_ingredients: nil)
    super
  end
end

#purpose ⇒ String? (readonly)

Returns the heading, such as "For the sauce", or nil for ungrouped ingredients.

Returns:

  • (String, nil) —

    the heading, such as "For the sauce", or nil for ungrouped ingredients



14
15
16
17
18
# File 'lib/recipe_scrapers/models/ingredient_group.rb', line 14

IngredientGroup = Data.define(:purpose, :ingredients, :parsed_ingredients) do
  def initialize(purpose:, ingredients:, parsed_ingredients: nil)
    super
  end
end