Sha256: b87c3922c07ed50c0ad302ee8d8f6e4939067ec567beb6ab0af7f7948572ae01

Contents?: true

Size: 953 Bytes

Versions: 6

Compression:

Stored size: 953 Bytes

Contents

# frozen_string_literal: true

module Kitchen::Directions::AnswerKeyInnerContainer
  def self.v1(chapter:, metadata_source:, append_to:, solutions_plural: true)
    V1.new.bake(
      chapter: chapter,
      metadata_source: metadata_source,
      append_to: append_to,
      solutions_plural: solutions_plural
    )
  end

  class V1
    renderable

    def bake(chapter:, metadata_source:, append_to:, solutions_plural:)
      @solutions_or_solution = solutions_plural ? 'solutions' : 'solution'
      @uuid_key = "#{@solutions_or_solution}#{chapter.count_in(:book)}"
      @metadata = metadata_source.children_to_keep.copy
      @composite_element = 'composite-page'
      @title = "#{I18n.t(:chapter)} #{chapter.count_in(:book)}"
      @main_title_tag = 'h2'

      append_to.append(
        child: render(file: '../book_answer_key_container/eob_answer_key_container.xhtml.erb')
      ).first("div[data-uuid-key='.#{@uuid_key}']")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
openstax_kitchen-19.0.0 lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb
openstax_kitchen-18.0.0 lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb
openstax_kitchen-17.1.0 lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb
openstax_kitchen-17.0.0 lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb
openstax_kitchen-16.0.0 lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb
openstax_kitchen-15.0.0 lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb