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.



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

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

Instance Attribute Details

#attribute_countObject (readonly)



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

def attribute_count
  @attribute_count
end

#type_nameObject (readonly)



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

def type_name
  @type_name
end

Instance Method Details

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

Returns:

  • (Boolean)


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

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

#hashObject



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

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

#sequence_sizeObject



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

def sequence_size
  @attribute_count
end