Method: Puppet::Pops::Types::PObjectType#extract_init_hash

Defined in:
lib/puppet/pops/types/p_object_type.rb

#extract_init_hash(o) ⇒ Object

API:

  • public



595
596
597
598
599
600
601
602
603
604
605
606
# File 'lib/puppet/pops/types/p_object_type.rb', line 595

def extract_init_hash(o)
  return o._pcore_init_hash if o.respond_to?(:_pcore_init_hash)

  result = {}
  pic = parameter_info(o.class)
  attrs = attributes(true)
  pic[0].each do |name|
    v = o.send(name)
    result[name] = v unless attrs[name].default_value?(v)
  end
  result
end