Class: CooklangRb::Timer

Inherits:
Tag
  • Object
show all
Includes:
WithUnits
Defined in:
lib/cooklang_rb/timer.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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from WithUnits

included

Methods inherited from Tag

#clean_name

Methods included from QuantityResolver

#resolve_quantity

Methods included from Steppable

included

Methods included from TagParser

included

Constructor Details

#initialize(name:, quantity: "", units: "") ⇒ Timer

Returns a new instance of Timer.



14
15
16
17
18
# File 'lib/cooklang_rb/timer.rb', line 14

def initialize(name:, quantity: "", units: "")
  @name = name ? clean_name(name) : ""
  @quantity = resolve_quantity(quantity)
  @units = clean_units(units)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/cooklang_rb/timer.rb', line 8

def name
  @name
end

#quantityObject (readonly)

Returns the value of attribute quantity.



8
9
10
# File 'lib/cooklang_rb/timer.rb', line 8

def quantity
  @quantity
end

#unitsObject (readonly)

Returns the value of attribute units.



8
9
10
# File 'lib/cooklang_rb/timer.rb', line 8

def units
  @units
end

Class Method Details

.tagObject



10
11
12
# File 'lib/cooklang_rb/timer.rb', line 10

def self.tag
  TIMER_TAG
end