Method: Puppet::Pops::Types::StringConverter#string_PUndefType

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

#string_PUndefType(val_type, val, format_map, _) ⇒ 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.

API:

  • private



634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
# File 'lib/puppet/pops/types/string_converter.rb', line 634

def string_PUndefType(val_type, val, format_map, _)
  f = get_format(val_type, format_map)
  apply_string_flags(f, case f.format
  when :n
    f.alt? ? 'null' : 'nil'
  when :u
    f.alt? ? 'undefined' : 'undef'
  when :d, :x, :X, :o, :b, :B, :e, :E, :f, :g, :G, :a, :A
    'NaN'
  when :v
    'n/a'
  when :V
    'N/A'
  when :s
    f.alt? ? '""' : ''
  when :p
    f.alt? ? '"undef"' : 'undef'
  else
    raise FormatError.new('Undef', f.format, 'nudxXobBeEfgGaAvVsp')
  end)
end