EDITED QUESTION
I have the following method:
def stats_by_day(league)
league.days_of_league.collect do |day|
roster_for(league).collect do |celeb|
celeb.tweets_this_day(day).inject(0) {|sum, n| sum + n.retweet_count + n.favorite_count}
end
end
end
This gives me:
Day1, Day2, Day3 Day1 Day2 Day3
[345, 647, 567], [344, 222, 675] etc
TEAM1 TEAM2
However what I want is
Team1 Team2 Team3 Team1 Team2 Team3
[345, 344, 567] [647, 222, 876]
DAY1 DAY2
I've tried switching the 2nd and 3rd lines of the method but that didn't work. Do I have what I need to get my desired output?
OLD QUESTION (for reference)
If I have...
[[a1,b1,c1],[a2,b2,c2],[a3,b3,c3]]
how would I get...
[[a1,a2,a3],[b1,b2,b3],[c1,c2,c3]]
Looking for a ruby approach. Thanks!
a1,b1,... to be methods or local variables? If so, your output must contain the values of those methods or variables. For example, ifa1=1,b1=2,a2=3,b2=4, wherea=[[a1,b1],[a2,b2]] => [[1,2],[3,4]], your desired result be[[1,3][2,4]]. If you meant to have[[:a1, :a2...or[['a1', 'a2'..., please edit both arrays.