Class: Qti::Exporter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assessment_test, args = {}) ⇒ Exporter

Returns a new instance of Exporter.



5
6
7
8
9
10
11
# File 'lib/qti/exporter.rb', line 5

def initialize(assessment_test, args = {})
  @logger = args[:logger] || NullLogger.new
  @assessment_test = assessment_test
  @package_root_path = args[:package_root_path] || '.'
  @exported_file_path =
    File.join(File.expand_path('..', package_root_path), File.basename(export_file_name)) + '.zip'
end

Instance Attribute Details

#assessment_testObject (readonly)

Returns the value of attribute assessment_test.



3
4
5
# File 'lib/qti/exporter.rb', line 3

def assessment_test
  @assessment_test
end

#exported_file_pathObject (readonly)

Returns the value of attribute exported_file_path.



3
4
5
# File 'lib/qti/exporter.rb', line 3

def exported_file_path
  @exported_file_path
end

#loggerObject (readonly)

Returns the value of attribute logger.



3
4
5
# File 'lib/qti/exporter.rb', line 3

def logger
  @logger
end

#package_root_pathObject (readonly)

Returns the value of attribute package_root_path.



3
4
5
# File 'lib/qti/exporter.rb', line 3

def package_root_path
  @package_root_path
end

Instance Method Details

#exportObject



13
14
15
16
17
18
19
# File 'lib/qti/exporter.rb', line 13

def export
  Dir.mkdir(package_root_path) unless File.exist?(package_root_path)
  create_assessment_xml
  create_imsmanifest_xml
  export_items
  compress_package
end