class Kitchen::Directions::MoveSolutionsFromNumberedNote::V1

Public Instance Methods

bake(chapter:, append_to:, note_class:) click to toggle source
# File lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb, line 9
    def bake(chapter:, append_to:, note_class:)
      solutions_clipboard = chapter.notes("$.#{note_class}").solutions.cut

      return if solutions_clipboard.items.empty?

      title = <<~HTML
        <h3 data-type="title">
          <span class="os-title-label">#{I18n.t(:"notes.#{note_class}")}</span>
        </h3>
      HTML

      append_to.append(child:
        Kitchen::Directions::SolutionAreaSnippet.v1(
          title: title, solutions_clipboard: solutions_clipboard
        )
      )
    end