Class: Range
Instance Method Summary collapse
Instance Method Details
#split_by_step(step) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/support/core_extensions.rb', line 50 def split_by_step(step) current_min = min arr = [] while (current_min + step) <= max current_max = current_min + step arr << (current_min..current_max) current_min = (current_max + 1) end arr << (current_min..max) unless current_min > max arr end |