Refactoring: Prefer each_with_object over tap.
This commit is contained in:
parent
c710389c80
commit
ef17e67b60
1 changed files with 3 additions and 5 deletions
|
@ -204,11 +204,9 @@ module HasGroups
|
||||||
return {} if !active?
|
return {} if !active?
|
||||||
return {} if !groups_access_permission?
|
return {} if !groups_access_permission?
|
||||||
|
|
||||||
{}.tap do |hash|
|
groups.access.where(active: true).pluck(key, :access).each_with_object({}) do |entry, hash|
|
||||||
groups.access.where(active: true).pluck(key, :access).each do |entry|
|
hash[ entry[0] ] ||= []
|
||||||
hash[ entry[0] ] ||= []
|
hash[ entry[0] ].push(entry[1])
|
||||||
hash[ entry[0] ].push(entry[1])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue