class Puppet::Pops::Types::SizeMismatch
@api private
Public Instance Methods
from()
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 449 def from 450 @expected.from || 0 451 end
merge(path, o)
click to toggle source
@return A new instance with the least restrictive respective boundaries
# File lib/puppet/pops/types/type_mismatch_describer.rb 458 def merge(path, o) 459 range = PIntegerType.new(from < o.from ? from : o.from, to > o.to ? to : o.to) 460 self.class.new(path, range, @actual) 461 end
message(variant, position)
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 463 def message(variant, position) 464 "#{variant}#{position} expects size to be #{range_to_s(expected, '0')}, got #{range_to_s(actual, '0')}" 465 end
range_to_s(range, zero_string)
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 467 def range_to_s(range, zero_string) 468 min = range.from || 0 469 max = range.to || Float::INFINITY 470 if min == max 471 min == 0 ? zero_string : min.to_s 472 elsif min == 0 473 max == Float::INFINITY ? 'unlimited' : "at most #{max}" 474 elsif max == Float::INFINITY 475 "at least #{min}" 476 else 477 "between #{min} and #{max}" 478 end 479 end
to()
click to toggle source
# File lib/puppet/pops/types/type_mismatch_describer.rb 453 def to 454 @expected.to || Float::INFINITY 455 end