Apply Style/CollectionMethods rubocop rule

We were already using `map` and `reduce` almost everywhere.
This commit is contained in:
Javi Martín
2019-10-26 00:44:19 +02:00
parent e3bfcbcd25
commit eafb4018bf
27 changed files with 57 additions and 56 deletions

View File

@@ -15,7 +15,7 @@ module Dashboard::GroupSupports
def accumulate_supports(grouped_votes)
grouped_votes.each do |group, votes|
grouped_votes[group] = votes.inject(0) { |sum, vote| sum + vote.vote_weight }
grouped_votes[group] = votes.reduce(0) { |sum, vote| sum + vote.vote_weight }
end
accumulated = 0

View File

@@ -20,7 +20,7 @@ module RemotelyTranslatable
end
def resources_groups(*args)
feeds = args.detect { |arg| arg&.first.class == Widget::Feed } || []
feeds = args.find { |arg| arg&.first.class == Widget::Feed } || []
args.compact - [feeds] + feeds.map(&:items)
end