Class | Range |
In: |
lib/sequel_core/core_ext.rb
|
Parent: | Object |
Returns the interval between the beginning and end of the range.
For exclusive ranges, is one less than the inclusive range:
(0..10).interval # => 10 (0...10).interval # => 9
Only works for numeric ranges, for other ranges the result is undefined, and the method may raise an error.
# File lib/sequel_core/core_ext.rb, line 159 159: def interval 160: last - first - (exclude_end? ? 1 : 0) 161: end