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

Methods inherited from Mismatch

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

Constructor Details

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

Instance Method Details

#actual_stringObject



256
257
258
259
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 256

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

#message(variant, position) ⇒ Object



252
253
254
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 252

def message(variant, position)
  "#{variant}#{position} expects a match for #{expected}, got #{actual_string}"
end