Class: Puppet::Pops::Serialization::Extension::PcoreObjectStart

Inherits:
Object
  • Object
show all
Includes:
SequenceStart
Defined in:
lib/puppet/pops/serialization/extension.rb

Overview

The class that triggers the use of the PCORE_OBJECT_START extension. The payload is the name of the object type and the number of attributes in the instance.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type_name, attribute_count) ⇒ PcoreObjectStart

Returns a new instance of PcoreObjectStart.



106
107
108
109
# File 'lib/puppet/pops/serialization/extension.rb', line 106

def initialize(type_name, attribute_count)
  @type_name = type_name
  @attribute_count = attribute_count
end

Instance Attribute Details

#attribute_countObject (readonly)



104
105
106
# File 'lib/puppet/pops/serialization/extension.rb', line 104

def attribute_count
  @attribute_count
end

#type_nameObject (readonly)



104
105
106
# File 'lib/puppet/pops/serialization/extension.rb', line 104

def type_name
  @type_name
end

Instance Method Details

#eql?(o) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


115
116
117
# File 'lib/puppet/pops/serialization/extension.rb', line 115

def eql?(o)
  o.is_a?(PcoreObjectStart) && o.type_name == @type_name && o.attribute_count == @attribute_count
end

#hashObject



111
112
113
# File 'lib/puppet/pops/serialization/extension.rb', line 111

def hash
  @type_name.hash * 29 + attribute_count.hash
end

#sequence_sizeObject



120
121
122
# File 'lib/puppet/pops/serialization/extension.rb', line 120

def sequence_size
  @attribute_count
end