Created
January 14, 2016 12:38
-
-
Save mguentner/39d095a33a2a0a7054fc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'json' | |
file = File.read("chains.json") | |
data = JSON.parse(file) | |
unknowncount = 0 | |
for effect in data | |
filename = "" | |
for element in effect | |
if element.class == String | |
if element != "" | |
filename = element | |
end | |
end | |
end | |
if filename == "" | |
filename = "unknown" + unknowncount.to_s | |
unknowncount+=1 | |
end | |
filename = filename.gsub(/[^a-zA-Z0-9]/, "_") + ".chain" | |
file = File.new(filename, "w+") | |
file.puts(effect.to_json) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment