Class: Kitchen::Directions::MoveSolutionsFromNumberedNote::V1

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb

Instance Method Summary collapse

Instance Method Details

#bake(chapter:, append_to:, note_class:) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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 = "    <h3 data-type=\"title\">\n      <span class=\"os-title-label\">\#{I18n.t(:\"notes.\#{note_class}\")}</span>\n    </h3>\n  HTML\n\n  append_to.append(child:\n    Kitchen::Directions::SolutionAreaSnippet.v1(\n      title: title, solutions_clipboard: solutions_clipboard\n    )\n  )\nend\n"