Sha256: f1ea1fa646e47712bd0c9f36ae30e1ba7c493392ce9fbd7d97786750fb5a3483

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require_relative 'concept_ai_gift_exporter'
require_relative 'code_gift_exporter'
require_relative '../version'
require_relative '../application'

# Export Data (ConceptIA and Code) to gift to outputfile
module DataGiftExporter
  ##
  # Export an array of Data (ConceptAI and Code objects) into GIFT outpufile
  # @param data (Hash)
  # @param project (Project)
  def self.export_all(data, project)
    file = File.open(project.get(:outputpath), 'w')
    file.write('// ' + ('=' * 50) + "\n")
    file.write("// Created by : #{Asker::NAME}")
    file.write(" (version #{Asker::VERSION})\n")
    file.write("// File       : #{project.get(:outputname)}\n")
    file.write("// Time       : #{Time.new}\n")
    file.write('// ' + ('=' * 50) + "\n\n")
    category = Application.instance.config['questions']['category']
    file.write("$CATEGORY: $course$/#{category}\n") unless category.nil?

    ConceptAIGiftExporter.export_all(data[:concepts_ai], file)
    CodeGiftExporter.export_all(data[:codes_ai], file)

    file.close
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
asker-tool-2.6.0 lib/asker/exporter/data_gift_exporter.rb
asker-tool-2.5.9 lib/asker/exporter/data_gift_exporter.rb
asker-tool-2.5.8 lib/asker/exporter/data_gift_exporter.rb
asker-tool-2.5.7 lib/asker/exporter/data_gift_exporter.rb
asker-tool-2.5.6 lib/asker/exporter/data_gift_exporter.rb
asker-tool-2.5.5 lib/asker/exporter/data_gift_exporter.rb