Skip to content

Commit

Permalink
Handle a range when end of a file is met
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolalsvk committed Aug 1, 2017
1 parent 1ed1305 commit 8d7b443
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/ordinare.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,23 @@ def find_ranges_of_gems(content)

if gem && !gems[index - 1]
current_range[:start_index] = index
current_range[:end_index] = index if index == gems.length - 1

ranges_to_sort << current_range
ranges_to_sort << current_range unless ranges_to_sort.any? { |range| range[:start_index] == index }
elsif gem && gems[index - 1] && !gems[index + 1]
ranges_to_sort.map do |range|
range[:start_index] == start_index ? current_range[:end_index] = index : range
if range[:start_index] == start_index
range[:end_index] = index
end

range
end
end
end
ranges_to_sort
end

def range_inside(range)

end
end

0 comments on commit 8d7b443

Please sign in to comment.