Method: Puppet::Util::PsychSupport#encode_with
- Defined in:
- lib/puppet/util/psych_support.rb
#encode_with(psych_encoder) ⇒ Object
This method is called from the Psych Yaml serializer The serializer will call this method to create a hash that will be serialized to YAML. Instead of using the object itself during the mapping process we use what is returned by calling ‘to_data_hash` on the object itself since some of the objects we manage have asymmetrical serialization and deserialization.
26 27 28 29 |
# File 'lib/puppet/util/psych_support.rb', line 26 def encode_with(psych_encoder) tag = Psych.[self.class] || "!ruby/object:#{self.class.name}" psych_encoder.represent_map(tag, to_data_hash) end |