Class: Kitchen::Directions::BakeUnitTitle::V1
- Defined in:
- lib/kitchen/directions/bake_unit_title/v1.rb
Instance Method Summary collapse
Instance Method Details
#bake(book:) ⇒ Object
5 6 7 8 9 |
# File 'lib/kitchen/directions/bake_unit_title/v1.rb', line 5 def bake(book:) book.units.each do |unit| compose_unit_title(unit: unit) end end |
#compose_unit_title(unit:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/kitchen/directions/bake_unit_title/v1.rb', line 11 def compose_unit_title(unit:) heading = unit.title heading.replace_children(with: <<~HTML <span class="os-part-text">#{I18n.t(:unit)} </span> <span class="os-number">#{unit.count_in(:book)}</span> <span class="os-divider"> </span> <span data-type="" itemprop="" class="os-text">#{heading.text}</span> HTML ) end |