Sha256: 255ef7f24f99cf85445815daf26cb8a898964faa1890d50058eda859ff2f9f47

Contents?: true

Size: 1.11 KB

Versions: 28

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

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 file (File)
  def self.export_all(concepts_ai, file)
    concepts_ai.each { |concept_ai| export(concept_ai, file) }
  end

  ##
  # Export 1 concept_ai from project
  # @param concept_ai (ConceptAI)
  # @param file (File)
  private_class_method def self.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
  private_class_method def self.head(name)
    s = "\n"
    s += '// ' + '=' * 50 + "\n"
    s += "// Concept name: #{name}\n"
    s += '// ' + '=' * 50 + "\n"
    s
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
asker-tool-2.6.0 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.5.9 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.5.8 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.5.7 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.5.6 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.5.5 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.5.4 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.5.3 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.5.2 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.5.1 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.5.0 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.4.5 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.4.4 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.4.3 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.4.2 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.4.1 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.4.0 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.3.4 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.3.3 lib/asker/exporter/concept_ai_gift_exporter.rb
asker-tool-2.3.2 lib/asker/exporter/concept_ai_gift_exporter.rb