This commit is contained in:
Alexander Munch-Hansen 2019-10-21 16:21:00 +02:00
parent f5911f4cb6
commit 88b238da44

View File

@ -22,18 +22,19 @@ def compare_to(sortings)
end
if defined? third
"if (#{(comp first)[:if]}) {
return #{(comp first)[:ret]};
} else if (#{(comp second)[:if]}) {
return #{(comp second)[:ret]};
}
return #{(comp third)[:ret]};"
else
"if (#{(comp first)[:if]}) {
return #{(comp first)[:ret]};
}
return #{(comp second)[:ret]};
"
pls = sortings.slice(1,sortings.length - 2).map do |ele|
" else if (#{(comp ele)[:if]}) {
return #{(comp ele)[:ret]};
}"
end
"if (#{(comp first)[:if]}) {
return #{(comp first)[:ret]};
}
#{pls.join "\n"}
return #{(comp sortings[sortings.length-1])[:ret]};"
end