Sha256: c0bc74d165c5b1f0b262ea0ed712aeb92974308a31ba7b797bed0fbc65a97e3f

Contents?: true

Size: 970 Bytes

Versions: 1

Compression:

Stored size: 970 Bytes

Contents

# encoding: utf-8

require_relative '../project'
require_relative '../formatter/question_gift_formatter'

# Export ConceptIA data to gift to outputfile
module ConceptAIGiftExporter
  ##
  # Export an array of ConceptAI objects from Project into GIFT outpufile
  # @param concepts_ai (Array)
  # @param project (Project)
  def self.export_all(concepts_ai, project)
    concepts_ai.each { |concept_ai| export(concept_ai, project) }
  end

  private_class_method def self.export(concept_ai, project)
    return unless concept_ai.process?

    file = project.get(:outputfile)
    file.write head(concept_ai.name)
    Application.instance.config['questions']['stages'].each do |stage|
      concept_ai.questions[stage].each do |question|
        file.write(QuestionGiftFormatter.to_s(question))
      end
    end
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asker-tool-2.1.6 lib/asker/exporter/concept_ai_gift_exporter.rb