Sha256: 2d0cbc55fac6b07d7794fd580e1c90cb5a3d9b1d2d6c0eadf4d973627062e63c

Contents?: true

Size: 987 Bytes

Versions: 5

Compression:

Stored size: 987 Bytes

Contents

require_relative "question_gift_formatter"

class ExportConcept2Gift
  ##
  # Export an array of ConceptAI objects from Project into GIFT outpufile
  # @param concepts_ai (Array)
  # @param file (File)
  def call(concepts_ai, file)
    concepts_ai.each { |concept_ai| export(concept_ai, file) }
  end

  private

  ##
  # Export 1 concept_ai from project
  # @param concept_ai (ConceptAI)
  # @param file (File)
  def export(concept_ai, file)
    return unless concept_ai.concept.process?

    file.write head(concept_ai.concept.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

  ##
  # Convert Concept name into gift format head
  # @param name (String)
  # @return String
  def head(name)
    s = "\n"
    s += "// " + "=" * 50 + "\n"
    s += "// Concept name: #{name}\n"
    s += "// " + "=" * 50 + "\n"
    s
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
asker-tool-2.9.4 lib/asker/exporter/gift/export_concept2gift.rb
asker-tool-2.9.3 lib/asker/exporter/gift/export_concept2gift.rb
asker-tool-2.9.2 lib/asker/exporter/gift/export_concept2gift.rb
asker-tool-2.9.1 lib/asker/exporter/gift/export_concept2gift.rb
asker-tool-2.9.0 lib/asker/exporter/gift/export_concept2gift.rb