Method: Puppet::Pops::Types::PFloatType#merge

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

#merge(o) ⇒ PFloatType?

Concatenates this range with another range provided that the ranges intersect. When that’s not the case, this method will return ‘nil`

Parameters:

  • o (PFloatType)

    the range to concatenate with this range

Returns:

  • (PFloatType, nil)

    the concatenated range or ‘nil` when the ranges were apart



1222
1223
1224
1225
1226
1227
1228
1229
1230
# File 'lib/puppet/pops/types/types.rb', line 1222

def merge(o)
  if intersect?(o)
    min = @from <= o.from ? @from : o.from
    max = @to >= o.to ? @to : o.to
    PFloatType.new(min, max)
  else
    nil
  end
end