Class: Sqlite::DatasetSolutionParser
- Inherits:
-
Object
- Object
- Sqlite::DatasetSolutionParser
- Defined in:
- lib/dataset_solution_parser.rb
Instance Method Summary collapse
- #choose(_solution) ⇒ Object
-
#parse_test(test) ⇒ Object
If solutions comes in an explicit datasets, it was stored in instance variable.
Instance Method Details
#choose(_solution) ⇒ Object
29 30 31 |
# File 'lib/dataset_solution_parser.rb', line 29 def choose(_solution) @solutions end |
#parse_test(test) ⇒ Object
If solutions comes in an explicit datasets, it was stored in instance variable. Expected input: OpenStruct#{
solution_type: 'datasets',
examples: [
{
dataset: "INSERT INTO ...\nINSERT INTO ...",
solution_dataset: "id|field\n1|row1..."
}
]
}
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dataset_solution_parser.rb', line 16 def parse_test(test) data = [] @solutions = [] solution_query = '-- none' test.examples.each do |item| @solutions << item[:solution_dataset].scan(/(?!\|).+(?<!\|)/).join("\n") data.append item[:data] end return solution_query, data end |