Module: Psychgus::Ext::RegistrarExt

Defined in:
lib/psychgus/ext/yaml_tree_ext.rb

Overview

Extensions to Psych::Visitors::YAMLTree::Registrar.

Instance Method Summary collapse

Instance Method Details

#psychgus_unregister(target) ⇒ Object

Remove target from this Registrar to prevent it becoming an alias.

Parameters:

  • target (Object)

    the Object to remove from this Registrar



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/psychgus/ext/yaml_tree_ext.rb', line 28

def psychgus_unregister(target)
  if PSYCHGUS_PSYCH_VERSION < PSYCHGUS_PSYCH_VERSION_5_1_2
    return unless key?(target) && target.respond_to?(:object_id)

    @obj_to_node.delete(target.object_id)
  else # 5.1.2+
    return unless key?(target)

    @targets.delete(target)
    @obj_to_node.delete(target)
  end
end