Method: Puppet::Pops::Types::TypeMismatchDescriber#describe_mismatch

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

#describe_mismatch(name, expected, actual, tense = :ignored) ⇒ 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.

Describe a confirmed mismatch using present tense

Parameters:

  • name (String)

    name of mismatch

  • expected (PAnyType)

    expected type

  • actual (PAnyType)

    actual type

  • tense (Symbol) (defaults to: :ignored)

    deprecated and ignored



550
551
552
553
554
555
556
557
558
559
560
561
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 550

def describe_mismatch(name, expected, actual, tense = :ignored)
  tense_deprecated unless tense == :ignored
  errors = describe(expected, actual, [SubjectPathElement.new(name)])
  case errors.size
  when 0
    ''
  when 1
    errors[0].format.strip
  else
    errors.map(&:format).join("\n ")
  end
end