Class: Puppet::Pops::Serialization::RGen::RGenReader Private

Inherits:
Base
  • Object
show all
Includes:
InstanceReader
Defined in:
lib/puppet/pops/serialization/rgen.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance reader for RGen::Ecore objects

Constant Summary collapse

INSTANCE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

RGenReader.new

Instance Method Summary collapse

Methods inherited from Base

#features

Instance Method Details

#read(impl_class, value_count, deserializer) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:



20
21
22
23
24
25
26
27
# File 'lib/puppet/pops/serialization/rgen.rb', line 20

def read(impl_class, value_count, deserializer)
  features = features(impl_class)
  raise SerializationError, "Feature count mismatch for #{impl_class}" unless value_count == features.size
  # Deserializer must know about this instance before we read its attributes
  obj = deserializer.remember(impl_class.new)
  features.each { |feature| obj.setGeneric(feature.name, deserializer.read) }
  obj
end