Class: Puppet::Pops::Types::PatternMismatch Private

Inherits:
TypeMismatch show all
Defined in:
lib/puppet/pops/types/type_mismatch_describer.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary

Constants included from LabelProvider

LabelProvider::A, LabelProvider::AN, LabelProvider::SKIPPED_CHARACTERS, LabelProvider::VOWELS

Instance Attribute Summary

Attributes inherited from ExpectedActualMismatch

#actual, #expected

Attributes inherited from Mismatch

#path

Instance Method Summary collapse

Methods inherited from TypeMismatch

#label, #merge

Methods included from LabelProvider

#a_an, #a_an_uc, #article, #combine_strings, #label, #plural_s, #the, #the_uc

Methods inherited from ExpectedActualMismatch

#==, #hash, #initialize

Methods inherited from Mismatch

#==, #canonical_path, #chop_path, #eql?, #format, #hash, #initialize, #merge, #path_string, #to_s

Constructor Details

This class inherits a constructor from Puppet::Pops::Types::ExpectedActualMismatch

Instance Method Details

#actual_stringObject

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.


441
442
443
444
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 441

def actual_string
  a = actual
  a.is_a?(PStringType) && !a.value.nil? ? "'#{a.value}'" : short_name(a)
end

#message(variant, position) ⇒ 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.


431
432
433
434
435
436
437
438
439
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 431

def message(variant, position)
  e = expected
  value_pfx = ''
  if e.is_a?(POptionalType)
    e = e.optional_type
    value_pfx = 'an undef value or '
  end
  "#{variant}#{position} expects #{value_pfx}a match for #{e.to_alias_expanded_s}, got #{actual_string}"
end