Class: CooklangRb::Ingredient
- Includes:
- WithUnits
- Defined in:
- lib/cooklang_rb/ingredient.rb
Constant Summary
Constants included from TagParser
TagParser::COOKWARE_TAG, TagParser::INGREDIENT_TAG, TagParser::MULTI_NAME, TagParser::NAME, TagParser::QUANTITY, TagParser::TIMER_TAG, TagParser::UNITS
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#units ⇒ Object
readonly
Returns the value of attribute units.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, quantity: "some", units: "") ⇒ Ingredient
constructor
A new instance of Ingredient.
Methods included from WithUnits
Methods inherited from Tag
Methods included from QuantityResolver
Methods included from Steppable
Methods included from TagParser
Constructor Details
#initialize(name:, quantity: "some", units: "") ⇒ Ingredient
Returns a new instance of Ingredient.
14 15 16 17 18 |
# File 'lib/cooklang_rb/ingredient.rb', line 14 def initialize(name:, quantity: "some", units: "") @name = clean_name(name) @quantity = resolve_quantity(quantity, default: "some") @units = clean_units(units) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/cooklang_rb/ingredient.rb', line 8 def name @name end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
8 9 10 |
# File 'lib/cooklang_rb/ingredient.rb', line 8 def quantity @quantity end |
#units ⇒ Object (readonly)
Returns the value of attribute units.
8 9 10 |
# File 'lib/cooklang_rb/ingredient.rb', line 8 def units @units end |
Class Method Details
.tag ⇒ Object
10 11 12 |
# File 'lib/cooklang_rb/ingredient.rb', line 10 def self.tag INGREDIENT_TAG end |