Skip to content

Instantly share code, notes, and snippets.

@bplexico
Created July 16, 2013 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bplexico/6009167 to your computer and use it in GitHub Desktop.
Save bplexico/6009167 to your computer and use it in GitHub Desktop.
final insert_uncategorized_category
def insert_uncategorized_category(uncategorized)
insert_at = catch(:idx){
@categories.each_with_index do |c, idx|
throw(:idx, idx) if (uncategorized.topics_week || 0) > (c.topics_week || 0)
end
@categories.size
}
@categories.insert(insert_at, uncategorized)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment