Sha256: 4a7ea8e12bfb54006466dad78379540af5ce507ea3959fa23a0e2e4e40d9784c
Contents?: true
Size: 788 Bytes
Versions: 7
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true module Kitchen::Directions::MoveSolutionsToAnswerKey module Strategies class Default def bake(chapter:, append_to:) bake_section(chapter: chapter, append_to: append_to) end protected def bake_section(chapter:, append_to:) @selectors.each do |selector| chapter.search("#{selector} div[data-type='solution']").each do |solution| append_to.add_child(solution.cut.to_s) end end end # This method helps to obtain more strategy-specific params through # "strategy_options: {blah1: 1, blah2: 2}" def initialize(strategy_options) @selectors = strategy_options[:selectors] || (raise 'missing selectors for strategy') end end end end
Version data entries
7 entries across 7 versions & 1 rubygems