Method: Puppet::Pops::Types::TypeCalculator#infer_Object

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

#infer_Object(o) ⇒ 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.



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
# File 'lib/puppet/pops/types/type_calculator.rb', line 529

def infer_Object(o)
  if o.is_a?(PuppetObject)
    o._pcore_type
  else
    name = o.class.name
    return PRuntimeType.new(:ruby, nil) if name.nil? # anonymous class that doesn't implement PuppetObject is impossible to infer

    ir = Loaders.implementation_registry
    type = ir.nil? ? nil : ir.type_for_module(name)
    return PRuntimeType.new(:ruby, name) if type.nil?

    if type.is_a?(PObjectType) && type.parameterized?
      type = PObjectTypeExtension.create_from_instance(type, o)
    end
    type
  end
end