Sha256: c809a1fa6b7ba4beee2d8a0d6d19b02360a9e366dc74b1ad5475b1812631b8bd
Contents?: true
Size: 673 Bytes
Versions: 5
Compression:
Stored size: 673 Bytes
Contents
require_relative "question_gift_formatter" class ExportProblem2Gift ## # Export an Array of problems to gift format file # @param problems (Array) def call(problems, file) problems.each { |problem| export_one(problem, file) } end private def export_one(problem, file) return false unless problem.process? file.write head(problem) problem.questions.each do |question| file.write QuestionGiftFormatter.to_s(question) end true end def head(problem) s = "\n" s += "// " + "=" * 50 + "\n" s += "// Problem: #{problem.name} (#{problem.questions.size} questions)\n" s += "// " + "=" * 50 + "\n" s end end
Version data entries
5 entries across 5 versions & 1 rubygems