Merge pull request #1975 from orend/simplify_topic_posters_summary

simplify TopicPostersSummary
This commit is contained in:
Robin Ward 2014-02-19 12:30:10 -05:00
commit d56b1b1c74
1 changed files with 2 additions and 3 deletions

View File

@ -7,7 +7,7 @@ class TopicPostersSummary
end
def summary
sorted_top_posters.map { |user| user ? new_topic_poster_for(user) : nil }.compact
sorted_top_posters.compact.map(&method(:new_topic_poster_for))
end
private
@ -22,10 +22,9 @@ class TopicPostersSummary
def descriptions_by_id
@descriptions_by_id ||= begin
user_ids_with_descriptions.inject({}) do |descriptions, (id, description)|
user_ids_with_descriptions.each_with_object({}) do |(id, description), descriptions|
descriptions[id] ||= []
descriptions[id] << description
descriptions
end
end
end