Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f744e7d

Browse files
committed
array slicing works different in ruby than in python
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401205
1 parent ff10991 commit f744e7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/html5/tokenizer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ def data_state
287287
else
288288
chars = @stream.chars_until(["&", "<", ">", "-"])
289289
@token_queue << {:type => :Characters, :data => data + chars}
290-
@lastFourChars += (chars[-4, 4] || '').scan(/./)
291-
@lastFourChars = @lastFourChars[-4, 4] || []
290+
@lastFourChars += (chars[(-4 || chars.length), 4] || '').scan(/./)
291+
@lastFourChars = @lastFourChars[(@lastFourChars.length > 4 ? -4 : -@lastFourChars.length), 4] || []
292292
end
293293
return true
294294
end

0 commit comments

Comments
 (0)