Class: Kitchen::Directions::MoveExercisesToEOC::V2

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/directions/move_exercises_to_eoc/v2.rb

Overview

Main difference from v1 is the presence of a section title and some additional wrappers

Instance Method Summary collapse

Instance Method Details

#bake(chapter:, metadata_source:, klass:, append_to: nil, uuid_prefix: '.') ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/kitchen/directions/move_exercises_to_eoc/v2.rb', line 7

def bake(chapter:, metadata_source:, klass:, append_to: nil, uuid_prefix: '.')
  Kitchen::Directions::MoveCustomSectionToEocContainer.v1(
    chapter: chapter,
    metadata_source: ,
    container_key: klass,
    uuid_key: "#{uuid_prefix}#{klass}",
    section_selector: "section.#{klass}",
    append_to: append_to || chapter,
    wrap_section: true, wrap_content: true
  ) do |section|
    Kitchen::Directions::RemoveSectionTitle.v1(section: section)
    title = Kitchen::Directions::EocSectionTitleLinkSnippet.v1(page: section.ancestor(:page))
    section.prepend(child: title)
  end
end