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


100
101
102
103
# File 'lib/puppet/pops/serialization/extension.rb', line 100

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

Instance Attribute Details

#attribute_countObject (readonly)


99
100
101
# File 'lib/puppet/pops/serialization/extension.rb', line 99

def attribute_count
  @attribute_count
end

#type_nameObject (readonly)


99
100
101
# File 'lib/puppet/pops/serialization/extension.rb', line 99

def type_name
  @type_name
end

Instance Method Details

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


109
110
111
# File 'lib/puppet/pops/serialization/extension.rb', line 109

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

#hashObject


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

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

#sequence_sizeObject


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

def sequence_size
  @attribute_count
end