find_ranges

in lib/twitter_cldr/js/renderers/implementation/shared/bidi_renderer.rb [57:71]


            def find_ranges(list)
              ranges = []
              start_idx = 0
              list.each_with_index do |item, idx|
                if idx > 0
                  if list[idx - 1] < (item - 1)
                    ranges << (list[start_idx]..list[idx - 1])
                    start_idx = idx
                  end
                end
              end
              ranges << (list[start_idx]..list[list.size - 1]) unless list.empty?
              ranges
            end