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) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/asker/exporter/concept_ai_yaml_exporter.rb', line 9 def self.export_all(concepts_ai) questions = [] concepts_ai.each do |concept_ai| questions += get_questions_from concept_ai end project = Project.instance params = { lang: project.get(:lang) , projectname: project.get(:projectname) } output = { params: params, questions: questions } project.yamlfile.write(output.to_yaml) end |
.get_questions_from(concept_ai) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/asker/exporter/concept_ai_yaml_exporter.rb', line 21 def self.get_questions_from(concept_ai) data = [] return data unless concept_ai.process? stages = Project.instance.stages stages.each_key do |stage| concept_ai.questions[stage].each do |question| question.lang = concept_ai.lang data << QuestionHashFormatter.to_hash(question) end end data end |