lib/edtf/interval.rb
def max
      if block_given?
        to_a.max(&Proc.new)
      else
        case
        when open_end?, unknown_end?, !unknown_start? && to < from
          nil
        when to.day_precision?
          to
        when to.month_precision?
          to.end_of_month
        else
          to.end_of_year
        end
      end
    end
# call-seq:
#     interval.max                  -> Date or nil
#     interval.max { |a,b| block }  -> Date or nil
#
# Returns the maximum value in the interval. If a block is given, it is
# used to compare values (slower). Returns nil if the first date of the
# interval is larger than the last or if the interval has an unknown or
# open end.
#
# To calculate the dates, precision is taken into account. Thus, the max
# Date of "2007/2008" would be 2008-12-31, whilst the max Date of
# "2007-12/2008-10" would be 2009-10-31.
call-seq:
interval.max                  -> Date or nil
interval.max { |a,b| block }  -> Date or nil

Returns the maximum value in the interval. If a block is given, it is
used to compare values (slower). Returns nil if the first date of the
interval is larger than the last or if the interval has an unknown or
open end.

To calculate the dates, precision is taken into account.
call - seq : interval . max - > Date or nil interval . max { |a b| block } - > Date or nil Returns the maximum value in the interval . If a block is given it is used to compare values ( slower ) . Returns nil if the first date of the interval is larger than the last or if the interval has an unknown or open end . To calculate the dates precision is taken into account .
def max
      if block_given?
        to_a.max(&Proc.new)
      else
        case
        when open_end?, unknown_end?, !unknown_start? && to < from
          nil
        when to.day_precision?
          to
        when to.month_precision?
          to.end_of_month
        else
          to.end_of_year
        end
      end
    end
def max if block_given? to_a . max ( & Proc . new ) else case when open_end? , unknown_end? , ! unknown_start? && to < from nil when to . day_precision? to when to . month_precision? to . end_of_month else to . end_of_year end end end
call-seq:
interval.max                  -> Date or nil
interval.max { |a,b| block }  -> Date or nil
call - seq : interval . max - > Date or nil interval . max { |a b| block } - > Date or nil