Created
April 6, 2009 20:38
-
-
Save jqr/90930 to your computer and use it in GitHub Desktop.
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
def equalize_lists(one, two, empty_list_item = '<li> </li>') | |
difference = one.size - two.size | |
if difference == 0 | |
[one, two] | |
elsif difference > 0 | |
[one, two + [empty_list_item] * difference] | |
elsif difference < 0 | |
[one + [empty_list_item] * difference.abs, two] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment