Method: Puppet::Pops::Types::TypeFormatter#struct_element_pair

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

#struct_element_pair(t) ⇒ 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.



316
317
318
319
320
321
322
323
324
325
326
# File 'lib/puppet/pops/types/type_formatter.rb', line 316

def struct_element_pair(t)
  k = t.key_type
  value_optional = t.value_type.assignable?(PUndefType::DEFAULT)
  if k.is_a?(POptionalType)
    # Output as literal String
    k = t.name if value_optional
  else
    k = value_optional ? PNotUndefType.new(k) : t.name
  end
  [k, t.value_type]
end