Module: ConceptAIGiftExporter

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

Overview

Use to export data from ConceptIA to gift format

Class Method Summary collapse

Class Method Details

.export(concept_ai) ⇒ Object



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

def self.export(concept_ai)
  return unless concept_ai.process?

  file = Project.instance.outputfile
  file.write head(concept_ai.name)

  stages = Project.instance.stages
  stages.each_key do |stage|
    concept_ai.questions[stage].each do |question|
      file.write(QuestionGiftFormatter.to_s(question))
    end
  end
end

.export_all(concepts_ai) ⇒ Object



8
9
10
# File 'lib/asker/exporter/concept_ai_gift_exporter.rb', line 8

def self.export_all(concepts_ai)
  concepts_ai.each { |concept_ai| export(concept_ai) }
end

.head(name) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/asker/exporter/concept_ai_gift_exporter.rb', line 26

def self.head(name)
  s = "\n"
  s += '// ' + '=' * 50 + "\n"
  s += "// Concept name: #{name}\n"
  s += '// ' + '=' * 50 + "\n"
  s
end