Skip to content

Instantly share code, notes, and snippets.

@jqr
Created April 6, 2009 20:38
Show Gist options
  • Save jqr/90930 to your computer and use it in GitHub Desktop.
Save jqr/90930 to your computer and use it in GitHub Desktop.
def equalize_lists(one, two, empty_list_item = '<li>&nbsp;</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