class Kitchen::Directions::BakeUnitTitle::V1

Public Instance Methods

bake(book:) click to toggle source
# 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:) click to toggle source
# 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