Sha256: dc82fbe629c4f72a0df3ebf2d074277c775e0c04b8f405ad3569177e34dd5376

Contents?: true

Size: 885 Bytes

Versions: 6

Compression:

Stored size: 885 Bytes

Contents

require_relative '../version'
require_relative 'concept_ai_moodle_exporter'
require_relative 'code_moodle_exporter'

# Export data to MoodleXML file
module DataMoodleExporter

  def self.export_all(data, project)
    file = File.open(project.get(:moodlepath), 'w')
    file.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
    file.write("<quiz>\n")
    file.write("<!--\n#{('=' * 50)}\n")
    file.write(" Created by : #{Asker::NAME}")
    file.write(" (version #{Asker::VERSION})\n")
    file.write(" File       : #{project.get(:moodlename)}\n")
    file.write(" Time       : #{Time.new}\n")
    file.write("#{('=' * 50)}\n-->\n\n")

    data[:concepts_ai].each do |concept_ai|
      ConceptAIMoodleExporter.run(concept_ai, file)
    end

    data[:codes_ai].each do |code|
      CodeMoodleExporter.run(code, file)
    end

    file.write("</quiz>\n")
    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_moodle_exporter.rb
asker-tool-2.5.9 lib/asker/exporter/data_moodle_exporter.rb
asker-tool-2.5.8 lib/asker/exporter/data_moodle_exporter.rb
asker-tool-2.5.7 lib/asker/exporter/data_moodle_exporter.rb
asker-tool-2.5.6 lib/asker/exporter/data_moodle_exporter.rb
asker-tool-2.5.5 lib/asker/exporter/data_moodle_exporter.rb