Sha256: 5c54cad8a48efc60caf1b8f5c355e0d0005948f2bd733d9b6b92164458e919ef

Contents?: true

Size: 753 Bytes

Versions: 13

Compression:

Stored size: 753 Bytes

Contents

# frozen_string_literal: true

module Kitchen::Directions::MoveSolutionsFromNumberedNote
  def self.v1(chapter:, append_to:, note_class:)
    V1.new.bake(chapter: chapter, append_to: append_to, note_class: note_class)
  end

  class V1
    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
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
openstax_kitchen-19.0.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-18.0.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-17.1.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-17.0.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-16.0.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-15.0.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-14.0.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-13.0.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-12.2.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-12.1.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-12.0.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-11.2.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
openstax_kitchen-11.1.0 lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb