Class: Export2YAML

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

Instance Method Summary collapse

Instance Method Details

#call(data, project) ⇒ Object

Export array of ConceptAI objects from Project to YAML output file

Parameters:

  • concepts_ai (Array)
  • project (Project)


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

def call(data, project)
  questions = []
  questions += get_questions_from_codes(data)
  questions += get_questions_from_concepts(data)
  questions += get_questions_from_problems(data)

  output = {
    lang: project.get(:lang_code),
    projectname: project.get(:projectname),
    questions: questions
  }

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