Sha256: fc5b3ba055432e4c20157443a5636e87b929efd123ea04177c1e139621f4a46e
Contents?: true
Size: 548 Bytes
Versions: 216
Compression:
Stored size: 548 Bytes
Contents
module Generator module CaseValues class Extractor def initialize(case_class:) @case_class = case_class end def cases(exercise_data) extract_test_cases(data: JSON.parse(exercise_data)['cases']) .map { |case_properties| @case_class.new(canonical: OpenStruct.new(case_properties)) } end private def extract_test_cases(data:) data.flat_map do |entry| entry.key?('cases') ? extract_test_cases(data: entry['cases']) : entry end end end end end
Version data entries
216 entries across 216 versions & 1 rubygems