Module: ConceptAIMoodleExporter

Defined in:
lib/asker/exporter/concept_ai_moodle_exporter.rb

Overview

Export ConceptIA data to gift to moodlefile

Class Method Summary collapse

Class Method Details

.export_all(concepts_ai, project) ⇒ Object

Export an array of ConceptAI objects from Project into Moodle format file

Parameters:

  • concepts_ai (Array)
  • project (Project)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/asker/exporter/concept_ai_moodle_exporter.rb', line 11

def self.export_all(concepts_ai, 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 : #{Application::NAME}")
  file.write(" (version #{Application::VERSION})\n")
  file.write(" File       : #{project.get(:moodlename)}\n")
  file.write(" Time       : #{Time.new}\n")
  file.write(" Author     : David Vargas Ruiz\n")
  file.write("#{('=' * 50)}\n-->\n\n")

  concepts_ai.each { |concept_ai| export(concept_ai, file) }

  file.write("</quiz>\n")
  file.close
end