Class: Range
Instance Method Summary collapse
-
#interval ⇒ Object
Returns the interval between the beginning and end of the range.
Instance Method Details
#interval ⇒ 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.
159 160 161 |
# File 'lib/sequel_core/core_ext.rb', line 159 def interval last - first - (exclude_end? ? 1 : 0) end |