Method: Enumerable#range
- Defined in:
- lib/active_object/enumerable.rb
#range(identity = 0) ⇒ Object
rubocop:enable Metrics/AbcSize
244 245 246 247 248 249 |
# File 'lib/active_object/enumerable.rb', line 244 def range(identity = 0) return identity unless length.positive? collection_sorted = sort collection_sorted.last - collection_sorted.first end |