Created
May 6, 2016 20:15
-
-
Save arjunvenkat/9fe2d4c2e88885a0e349175999122f01 to your computer and use it in GitHub Desktop.
Parse through JSON grade output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this file should live in the same directory as the JSON grade output | |
require 'json' | |
output = File.open( "output.txt","w" ) | |
Dir.foreach('.') do |item| | |
next if item == '.' || item == '..' || item.include?('json') == false | |
file = File.read(item) | |
score = JSON.parse(file)['summary_line'] | |
output.write("#{item} - #{score}\n") | |
puts "#{item} #{score}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment