variadic compareTo, yay
This commit is contained in:
parent
f75a9a7b4f
commit
f11bd7c456
|
@ -19,21 +19,16 @@ def compare_to(sortings)
|
||||||
:ret => (return_stat.call sorting)[:ret]}
|
:ret => (return_stat.call sorting)[:ret]}
|
||||||
end}
|
end}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pls = sortings.slice(1,sortings.length - 2).map do |ele|
|
pls = sortings.slice(1,sortings.length - 2).map do |ele|
|
||||||
" else if (#{(comp ele)[:if]}) {
|
"else if (#{(comp.call ele)[:if]}) {
|
||||||
return #{(comp ele)[:ret]};
|
\t\t\treturn #{(comp.call ele)[:ret]};
|
||||||
}"
|
\t\t}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
"\t\tif (#{(comp.call first)[:if]}) {
|
||||||
|
\t\t\treturn #{(comp.call first)[:ret]};
|
||||||
|
\t\t}
|
||||||
|
\t\t#{pls.join "\n"}
|
||||||
|
\t\treturn #{(comp.call sortings[sortings.length-1])[:ret]};"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"if (#{(comp first)[:if]}) {
|
|
||||||
return #{(comp first)[:ret]};
|
|
||||||
}
|
|
||||||
#{pls.join "\n"}
|
|
||||||
return #{(comp sortings[sortings.length-1])[:ret]};"
|
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user