Sha256: a8891bbc392378dd9329b63e8e0fa19d066d5e6c0c4ca5af4da08ed50bd159fa
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true module Kitchen::Directions::MoveSolutionsToAnswerKey module Strategies class ContemporaryMath def bake(chapter:, append_to:) solutions_clipboard = Kitchen::Clipboard.new chapter.notes('$.your-turn').exercises.each do |exercise| solution = exercise.solution next unless solution # Hacky numbering fix number = exercise.ancestor(:note).count_in(:chapter) solution.first('a.os-number').inner_html = number.to_s solution.first('span.os-divider').inner_html = '. ' solution.cut(to: solutions_clipboard) end title = <<~HTML <h3 data-type="title"> <span class="os-title-label">#{I18n.t(:'notes.your-turn')}</span> </h3> HTML append_solution_area(title: title, solutions: solutions_clipboard, append_to: append_to) end def append_solution_area(title:, solutions:, append_to:) append_to = append_to.add_child( <<~HTML <div class="os-solution-area"> #{title} </div> HTML ).first append_to.add_child(solutions.paste) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
openstax_kitchen-10.0.0 | lib/kitchen/directions/move_solutions_to_answer_key/strategies/contemporary_math.rb |