Class: StageT

Inherits:
BaseStage show all
Defined in:
lib/asker/ai/stages/stage_t.rb

Overview

StageT create questions based con Table data range t1-t9 rubocop:disable Metrics/ClassLength

Instance Method Summary collapse

Methods inherited from BaseStage

#concept, #images, #initialize, #lang, #name, #names, #neighbors, #num, #random_image_for, #texts, #type

Constructor Details

This class inherits a constructor from BaseStage

Instance Method Details

#run(table, row, list) ⇒ Object

process_tableXfields rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/asker/ai/stages/stage_t.rb', line 15

def run(table, row, list)
  questions = []
  return questions unless concept.type == 'text'

  if table.fields.count == 2
    questions += process_table2fields(table, row, list, 0, 1)
  elsif table.fields.count == 3
    questions += process_table2fields(table, row, list, 0, 1)
    questions += process_table2fields(table, row, list, 0, 2)
  elsif table.fields.count == 4
    questions += process_table2fields(table, row, list, 0, 1)
    questions += process_table2fields(table, row, list, 0, 2)
    questions += process_table2fields(table, row, list, 0, 3)
  end

  questions
end