Use BigInt when sorting filenames (#22)

This commit is contained in:
Alex Ling
2020-03-27 04:45:03 +00:00
parent 1a0c3d81ce
commit d58c83fbd8
2 changed files with 11 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
require "big"
IMGS_PER_PAGE = 5
macro layout(name)
@@ -56,7 +58,7 @@ def compare_alphanumerically(c, d)
return -1 if a.nil?
return 1 if b.nil?
if is_numeric(a) && is_numeric(b)
compare = a.to_i <=> b.to_i
compare = a.to_big_i <=> b.to_big_i
return compare if compare != 0
else
compare = a <=> b