Class: CooklangRb::Cookware
- Includes:
- WithUnits
- Defined in:
- lib/cooklang_rb/cookware.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: 1, units: "") ⇒ Cookware
constructor
A new instance of Cookware.
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: 1, units: "") ⇒ Cookware
Returns a new instance of Cookware.
16 17 18 19 20 |
# File 'lib/cooklang_rb/cookware.rb', line 16 def initialize(name:, quantity: 1, units: "") @name = clean_name(name) @quantity = resolve_quantity(quantity, default: 1) @units = clean_units(units) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/cooklang_rb/cookware.rb', line 10 def name @name end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
10 11 12 |
# File 'lib/cooklang_rb/cookware.rb', line 10 def quantity @quantity end |
#units ⇒ Object (readonly)
Returns the value of attribute units.
10 11 12 |
# File 'lib/cooklang_rb/cookware.rb', line 10 def units @units end |
Class Method Details
.tag ⇒ Object
12 13 14 |
# File 'lib/cooklang_rb/cookware.rb', line 12 def self.tag COOKWARE_TAG end |