Sha256: 732b0446bf75744087255c135240ed6fb76e60b5714ef4d98213985d5a9c8dab

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require_relative "gift/export_code2gift"
require_relative "gift/export_concept2gift"
require_relative "gift/export_problem2gift"
require_relative "../application"
require_relative "../version"

class Export2Gift
  ##
  # Export an array of Data (ConceptAIs, Codes and Problems objects) into GIFT file
  # @param data (Hash)
  # @param project (Project)
  def call(data, project)
    file = File.open(project.get(:outputpath), "w")
    file.write("// " + ("=" * 50) + "\n")
    file.write("// #{Asker::NAME}    : version #{Asker::VERSION}\n")
    file.write("// Filename : #{project.get(:outputname)}\n")
    file.write("// Datetime : #{Time.new}\n")
    file.write("// " + ("=" * 50) + "\n\n")
    category = Application.instance.config["questions"]["category"]
    file.write("$CATEGORY: $course$/#{category}\n") unless category.nil?

    ExportConcept2Gift.new.call(data[:concepts_ai], file)
    ExportCode2Gift.new.call(data[:codes_ai], file)
    ExportProblem2Gift.new.call(data[:problems], file)
    file.close
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
asker-tool-2.9.4 lib/asker/exporter/export2gift.rb
asker-tool-2.9.3 lib/asker/exporter/export2gift.rb
asker-tool-2.9.2 lib/asker/exporter/export2gift.rb
asker-tool-2.9.1 lib/asker/exporter/export2gift.rb
asker-tool-2.9.0 lib/asker/exporter/export2gift.rb