Created
October 8, 2021 14:38
-
-
Save mikz/b0246d2eeaa63a672e1e98a9b2961d1b to your computer and use it in GitHub Desktop.
Revisions
-
mikz revised this gist
Oct 8, 2021 . 1 changed file with 0 additions and 8 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,14 +4,6 @@ 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 } -
mikz created this gist
Oct 8, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #!/usr/bin/env ruby require 'yaml' require 'psych' require 'pry' class Unity3DStream < Psych::Handlers::DocumentStream def start_document version, tag_directives, implicit version = [1, 1] if version.empty? tag_directives = [["!u!", "tag:unity3d.com,2011:"]] if tag_directives.empty? super end end 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