Method: TimeRange#max
- Defined in:
- lib/time_range.rb
#max ⇒ Time
Reimplementation of Range#max. TimeRange makes one assumption; that ranges excluding end should be one second shorter than those that don’t.
Normal Ranges simply TypeError when excluding_end is true. However, since Ruby’s Time methods assume seconds anyway, it is reasonable to use seconds here.
Doing so enables the implementation of a number of useful TimeRange methods.
52 53 54 55 56 |
# File 'lib/time_range.rb', line 52 def max return self.end - 1 if exclude_end? super end |