@@ -224,7 +224,7 @@ def join_heredoc!
224224 #
225225 def join_consecutive!
226226 consecutive_groups = @document . select ( &:ignore_newline_not_beg? ) . map do |code_line |
227- take_while_including ( code_line . index ..- 1 ) do |line |
227+ take_while_including ( code_line . index ..) do |line |
228228 line . ignore_newline_not_beg?
229229 end
230230 end
@@ -245,7 +245,7 @@ def join_consecutive!
245245 # expect(lines[1].to_s).to eq("")
246246 def join_trailing_slash!
247247 trailing_groups = @document . select ( &:trailing_slash? ) . map do |code_line |
248- take_while_including ( code_line . index ..- 1 ) { |x | x . trailing_slash? }
248+ take_while_including ( code_line . index ..) { |x | x . trailing_slash? }
249249 end
250250 join_groups ( trailing_groups )
251251 self
@@ -279,7 +279,7 @@ def join_groups(groups)
279279 )
280280
281281 # Hide the rest of the lines
282- lines [ 1 ..- 1 ] . each do |line |
282+ lines [ 1 ..] . each do |line |
283283 # The above lines already have newlines in them, if add more
284284 # then there will be double newline, use an empty line instead
285285 @document [ line . index ] = CodeLine . new ( line : "" , index : line . index , lex : [ ] )
@@ -293,7 +293,7 @@ def join_groups(groups)
293293 # Like `take_while` except when it stops
294294 # iterating, it also returns the line
295295 # that caused it to stop
296- def take_while_including ( range = 0 ..- 1 )
296+ def take_while_including ( range = 0 ..)
297297 take_next_and_stop = false
298298 @document [ range ] . take_while do |line |
299299 next if take_next_and_stop
0 commit comments