Class: Moodle2CC::Moodle2::Extractor
- Inherits:
-
Object
- Object
- Moodle2CC::Moodle2::Extractor
- Defined in:
- lib/moodle2cc/moodle2/extractor.rb
Constant Summary collapse
- MOODLE_BACKUP_XML =
'moodle_backup.xml'
Instance Method Summary collapse
- #extract ⇒ Object
-
#initialize(backup_path) ⇒ Extractor
constructor
A new instance of Extractor.
Constructor Details
#initialize(backup_path) ⇒ Extractor
Returns a new instance of Extractor.
8 9 10 |
# File 'lib/moodle2cc/moodle2/extractor.rb', line 8 def initialize(backup_path) @backup_path = backup_path end |
Instance Method Details
#extract ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/moodle2cc/moodle2/extractor.rb', line 12 def extract if File.directory?(@backup_path) # it's already extracted course = extract_course(@backup_path) yield course else Dir.mktmpdir do |work_dir| extract_zip(work_dir) course = extract_course(work_dir) yield course end end end |