Skip to content

Instantly share code, notes, and snippets.

Created July 24, 2015 15:35
Show Gist options
  • Save anonymous/c9105f3a5d452d0275b8 to your computer and use it in GitHub Desktop.
Save anonymous/c9105f3a5d452d0275b8 to your computer and use it in GitHub Desktop.
Dir.glob('Modified/*.json').each do |item|
# file = File.open(item, "r+")
# from the above and etc, to the below
File.open(item, "r+") do |file|
hash = JSON.parse(file.read)
file.rewind
hash['version'] += 1
file.write(JSON.generate(hash))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment