Method: Puppet::Pops::Types::PObjectType#instance?

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

#instance?(o, guard = nil) ⇒ Boolean



454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/puppet/pops/types/p_object_type.rb', line 454

def instance?(o, guard = nil)
  if o.is_a?(PuppetObject)
    assignable?(o._pcore_type, guard)
  else
    name = o.class.name
    return false if name.nil? # anonymous class that doesn't implement PuppetObject is not an instance

    ir = Loaders.implementation_registry
    type = ir.nil? ? nil : ir.type_for_module(name)
    !type.nil? && assignable?(type, guard)
  end
end