Organizing a summer camp in Ruby.

Summer is here and I’ve got a business idea, a summer camp for teenagers, but I have one problem: I communicate only in Ruby.
Lets see if I’m gonna be able to run my camp.
I created a great looking advertisement and the first kid came in to join:

I have to see the kid’s age to make sure he is old enough. Pretty easy:

John is happy to join my camp and told me about his hobbies. Great information. I can organize some activities and an entertainment in my camp based on kids hobbies. Let me add it.

So this is how John looks now:

Next day few more teenagers joined my camp and I had to modify my kid hash into array of hashes:

After several days I had enough kids joined and I started my camp.

I can see hobbies of every kid, for example John:

I just curious who has the most amount of hobbies. To find that out I need to iterate trough all kids and count how many hobbies each kid has, store that data in a new array, then find a kid whose amount of hobbies is equal to maximum number in array:

What activities should I organize for the kids? If I take them to a hike are they going to enjoy it? I need to see how many kids like hiking:

Wow! Only one Alex! Hiking is not a good idea then. Let me find out what is the most popular hobby kids have:

I see that most kids like soccer. But before we go playing it let me break down this code:
First step: collecting all hobbies into a new array:
kids.each {|kid| array << kid[:hobby]}
=> array=[[“Swimming”, “Reading”, “Soccer”], [“Hiking”, “Reading”], [“Dancing”, “Skiing”, “Baking”, “Cartoons”], [“Drawing”], [“Card-games”, “Soccer”], [“Soccer”, “Reading”, “Cartoons”]]
As we can see the result is an array of arrays. I used .flatten method to modify it into one single array.
array = array.flatten
=> [“Swimming”, “Reading”, “Soccer”, “Hiking”, “Reading”, “Dancing”, “Skiing”, “Baking”, “Cartoons”, “Drawing”, “Card-games”, “Soccer”, “Soc er”, “Reading”, “Cartoons”]
Then I iterated on that array and created out of it a new hash that have a hobby as a key and amount as a value:
array.each do |i|
if hobbies[i]
hobbies[i]+=1
else
hobbies[i]=1
end
end
I hope all kids are going to enjoy a soccer game in my camp and I hope my summer camp helped someone better understand how to work with arrays and hashes.