psych
                                
                                 psych copied to clipboard
                                
                                    psych copied to clipboard
                            
                            
                            
                        Got "found undefined tag" error on parsing prefab file of unity3d
"found undefined tag handle while parsing a node at line 21 column 5 (Psych::SyntaxError)" I got this error on parsing unity3d prefab file with parse_stream method.
Psych.parse_stream(yaml, filename: path) do |node|
       puts node
end
line 21 is " --- !u!224 &224286004637740336" I can insert a new line "%TAG !u! tag:unity3d.com,2011: " before every "---" to fix it.
source.gsub(/^(?<!%TAG !u! tag:unity3d.com,2011:\n)^(--- !u![0-9]+ &[0-9]+)$/, "%TAG !u! tag:unity3d.com,2011:\n\\1")
But I hope there is a solution in API level.
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1007462957078648
GameObject:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  serializedVersion: 6
  m_Component:
  - component: {fileID: 224286004637740336}
  - component: {fileID: 222770377023727128}
  - component: {fileID: 114746315234884256}
  m_Layer: 5
  m_Name: Icon
  m_TagString: Untagged
  m_Icon: {fileID: 0}
  m_NavMeshLayer: 0
  m_StaticEditorFlags: 0
  m_IsActive: 1
--- !u!224 &224286004637740336
RectTransform:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 1007462957078648}
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
  m_LocalPosition: {x: 0, y: 0, z: -1.3}
  m_LocalScale: {x: 0.7, y: 0.7, z: 0.9996802}
  m_Children: []
  m_Father: {fileID: 224567198966254662}
  m_RootOrder: 0
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
  m_AnchorMin: {x: 0.5, y: 0.5}
  m_AnchorMax: {x: 0.5, y: 0.5}
  m_AnchoredPosition: {x: 45.3, y: -79.2}
  m_SizeDelta: {x: 132, y: 132}
  m_Pivot: {x: 0.5, y: 0.5}
I'm wondering how to solve this one too. Unity clearly thinks that the scope of a TAG directive is from the point of declaration to the end of the file. It appears that Psych thinks the scope extends only to the end of the document. Is there a "right" interpretation?
I've seen other YAML parsers with a "default tag" that could be set. Is there not one in psych?