Class: Puppet::Pops::Types::CountMismatch
- Inherits:
-
SizeMismatch
- Object
- Mismatch
- ExpectedActualMismatch
- SizeMismatch
- Puppet::Pops::Types::CountMismatch
- Defined in:
- lib/puppet/pops/types/type_mismatch_describer.rb
Instance Attribute Summary
Attributes inherited from ExpectedActualMismatch
Attributes inherited from Mismatch
Instance Method Summary collapse
-
#initialize(path, expected, actual) ⇒ CountMismatch
constructor
A new instance of CountMismatch.
- #message(variant, position) ⇒ Object
Methods inherited from SizeMismatch
#from, #merge, #range_to_s, #to
Methods inherited from ExpectedActualMismatch
Methods inherited from Mismatch
#==, #canonical_path, #chop_path, #hash, #merge, #path_string, #to_s
Constructor Details
#initialize(path, expected, actual) ⇒ CountMismatch
Returns a new instance of CountMismatch.
297 298 299 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 297 def initialize(path, expected, actual) super(path, expected, actual) end |
Instance Method Details
#message(variant, position) ⇒ Object
301 302 303 304 305 306 |
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 301 def (variant, position) min = expected.from || 0 max = expected.to || Float::INFINITY suffix = min == 1 && (max == 1 || max == Float::INFINITY) || min == 0 && max == 1 ? '' : 's' "#{variant}#{position} expects #{range_to_s(expected, 'no')} argument#{suffix}, got #{range_to_s(actual, 'none')}" end |