Class: InputLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/asker/loader/input_loader.rb

Instance Method Summary collapse

Instance Method Details

#call(inputdirs, internet = true) ⇒ Object

Load input data from every input directory

Parameters:

  • inputdirs (Array)


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

def call(inputdirs, internet = true)
  data = {
    world: nil,
    concepts: [], codes: [], problems: [],
    concepts_ai: [], codes_ai: []
  }
  inputdirs.each do |dirname|
    loaded = DirectoryLoader.call(dirname)
    data[:concepts] += loaded[:concepts]
    data[:codes] += loaded[:codes]
    data[:problems] += loaded[:problems]
  end
  create_questions(data, internet)
end