Created
June 25, 2015 19:19
-
-
Save xander-miller/1cf66969323b9189bf64 to your computer and use it in GitHub Desktop.
Used a lamda to DRY up my code. Ruby skill up! 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
res.sort! do |x,y| | |
archived = -> (z) {[:archived, 'archived'].include?(z.status)} | |
if archived.call(x) && archived.call(y) | |
0 | |
elsif !archived.call(x) && archived.call(y) | |
-1 | |
elsif archived.call(x) && !archived.call(y) | |
1 | |
elsif !archived.call(x) && !archived.call(y) | |
0 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment