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]}
|
||||
end}
|
||||
|
||||
|
||||
|
||||
pls = sortings.slice(1,sortings.length - 2).map do |ele|
|
||||
" else if (#{(comp ele)[:if]}) {
|
||||
return #{(comp ele)[:ret]};
|
||||
}"
|
||||
"else if (#{(comp.call ele)[:if]}) {
|
||||
\t\t\treturn #{(comp.call ele)[:ret]};
|
||||
\t\t}"
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
"if (#{(comp first)[:if]}) {
|
||||
return #{(comp first)[:ret]};
|
||||
}
|
||||
#{pls.join "\n"}
|
||||
return #{(comp sortings[sortings.length-1])[:ret]};"
|
||||
"\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]};"
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user