You can use #inject here instead of #tap + #each :)