Class: Export2Gift

Inherits:
Object
  • Object
show all
Defined in:
lib/asker/exporter/export2gift.rb

Instance Method Summary collapse

Instance Method Details

#call(data, project) ⇒ Object

Export an array of Data (ConceptAIs, Codes and Problems objects) into GIFT file

Parameters:

  • data (Hash)
  • project (Project)


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

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