Created
October 8, 2021 14:38
-
-
Save mikz/b0246d2eeaa63a672e1e98a9b2961d1b to your computer and use it in GitHub Desktop.
Parse unity yaml to ruby objects.
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
#!/usr/bin/env ruby | |
require 'yaml' | |
require 'psych' | |
require 'pry' | |
parser = Psych::Parser.new(Unity3DStream.new(&Proc.new{ |doc| binding.pry })) | |
str = ARGF.read.gsub(/^--- [!]u[!](\d+)/) { "--- !<tag:unity3d.com,2011/#{$1}>" }.gsub(/^(--- .+?) stripped/) { $1 } | |
parser.parse str | |
puts parser.handler.root.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment