Module: ConceptAIYAMLExporter

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

Overview

Use to export data from ConceptIA to YAML format

Class Method Summary collapse

Class Method Details

.export_all(concepts_ai, project) ⇒ Object

Export array of ConceptAI objects from Project to YAML output file

Parameters:

  • concepts_ai (Array)
  • project (Project)


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

def self.export_all(concepts_ai, project)
  questions = []
  concepts_ai.each do |concept_ai|
    questions += get_questions_from concept_ai
  end
  params = { lang: project.get(:lang) ,
             projectname: project.get(:projectname) }
  output = { params: params, questions: questions }

  yamlfile = File.open(project.get(:yamlpath), 'w')
  yamlfile.write(output.to_yaml)
  yamlfile.close
end