Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
extract insert and add topics methods
def insert_uncategorized_category(uncategorized)
insert_at = nil
@categories.each_with_index do |c, idx|
if (uncategorized.topics_week || 0) > (c.topics_week || 0)
insert_at = idx
break
end
end
@categories.insert(insert_at || @categories.size, uncategorized)
end
def add_uncategorized_topics(uncategorized_topics)
if @all_topics.present? && uncategorized.present?
uncategorized.displayable_topics = uncategorized_topics
@all_topics << uncategorized_topics
@all_topics.flatten!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment