Method: Interval#distance
- Defined in:
- lib/standard/facets/interval.rb
#distance ⇒ Object Also known as: length, size
Returns the length of the interval as the difference between the first and last elements. Returns nil if the sentinal objects do not support distance comparison (#distance).
TODO: Add n parameter to count segmentations like those produced by #each.
128 129 130 131 132 133 134 135 |
# File 'lib/standard/facets/interval.rb', line 128 def distance @last - @first #if @last.respond_to?( :distance ) # @last.distance( @first ) #else # #self.to_a.length #end end |