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

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

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, #label, #plural_s, #the, #the_uc

Methods inherited from ExpectedActualMismatch

#==, #hash, #initialize, #swap_expected

Methods inherited from Mismatch

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

Methods included from TenseVariants

#it_does_not_expect, #it_expects, #it_has_no

Constructor Details

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

Instance Method Details

#actual_stringObject



384
385
386
387
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 384

def actual_string
  a = actual
  a.is_a?(PStringType) && a.values.size == 1 ? "'#{a.values[0]}'" : a.simple_name
end

#message(variant, position, tense = :present) ⇒ Object



380
381
382
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 380

def message(variant, position, tense = :present)
  "#{variant}#{position} #{it_expects(tense)} a match for #{expected.to_alias_expanded_s}, got #{actual_string}"
end