I'm new to Ruby and trying to build a meeting app. I have three arrays containing hashes :
- one containing my scheduled meetings with dates and therefore an empty array of people
- one containing the people invited per meeting
- and a last one containing the people who refused
This materializes as:
meetings = [
{:id=>"1", :peoples=>[]}
{:id=>"2", :peoples=>[]}
{:id=>"3", :peoples=>[]}
]
invited_peoples = [
{:id=>"1", :peoples=>['Tom', 'Henry', 'Georges', 'Nicolas']}
{:id=>"2", :peoples=>['Arthur', 'Carl']}
]
absent_peoples = [
{:id=>"1", :peoples=>['Henry', 'Georges']}
]
And I would like to have : meetings + invited_peoples - absent_peoples like
meetings_with_participants = [
{:id=>"1", :peoples=>['Tom', 'Nicolas']}
{:id=>"2", :peoples=>['Arthur', 'Carl']}
{:id=>"3", :peoples=>[]}
]
I'm looking for a readable solution but I don't find anyone...
Sorry for my english and thank you in advance, Nicolas
Aucun commentaire:
Enregistrer un commentaire