我有一堂课,有一种方法:
class ScreenerProbe
def initialize
@body = {}
end
def import_simple_matrix(questions, answers)
@body['aliases'] = answers.map { |pair|
return { val: pair["text"], text: pair["value"] }
}
# this code doesn't seem to run
questions.each.with_index do |text, index|
@body["questions"][index + 1] = {
"title" => text,
"type" => 'default',
}
end
end
问题是一些代码似乎没有运行,即使我希望它运行。
ruby 2.6.6p146(2020-03-31 修订版 67876)[x86_64-darwin20]