lib/fat_period/period.rb
# Return the Period that is the union of self with `other` or nil if
# they neither overlap nor are contiguous
#
# @example
#   Period.parse('2015-3Q') + Period.parse('2015-2Q')    #=> Period(2015-04-01..2015-09-30)
#   Period.parse('2015') + Period.parse('2015-2Q')       #=> Period(2015-01-01..2015-12-31)
#   Period.parse('2015') + Period.parse('2017')          #=> nil
#   pp1 = Period.parse_phrase('from 2015-4Q to 2016-1H') #=> Period(2015-10-01-2015..2015-12-31)
#   pp2 = Period.parse_phrase('from 2015-3Q to 2015-11') #=> Period(2015-07-01-2015..2015-11-30)
#   pp1 + pp2                                            #=> Period(2015-10-01..2015-11-30)
#
# @param other [Period] other Period
# @return [Period, nil] self union `other`?
Return the Period that is the union of self with `other` or nil if
they neither overlap nor are contiguous
Return the Period that is the union of self with ` other ` or nil if they neither overlap nor are contiguous
def union(other)
    result = to_range.union(other.to_range)
    return nil if result.nil?
    Period.new(result.first, result.last)
  end
def union ( other ) result = to_range . union ( other . to_range ) return nil if result . nil? Period . new ( result . first , result . last ) end
Return the Period that is the union of self with `other` or nil if
they neither overlap nor are contiguous
Return the Period that is the union of self with ` other ` or nil if they neither overlap nor are contiguous
None
Period, nil
other
None
example
None