Class: RecipeScrapers::Models::IngredientGroup
- Inherits:
-
Data
- Object
- Data
- RecipeScrapers::Models::IngredientGroup
- 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
-
#ingredients ⇒ Array<String>
readonly
The ingredient lines of the group.
-
#parsed_ingredients ⇒ Array<Models::Ingredient>?
readonly
The same lines split into an amount, a unit and a name, in the same order.
-
#purpose ⇒ String?
readonly
The heading, such as "For the sauce", or nil for ungrouped ingredients.
Instance Method Summary collapse
-
#initialize(purpose:, ingredients:, parsed_ingredients: nil) ⇒ IngredientGroup
constructor
A new instance of IngredientGroup.
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.
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.
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.
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 |