Skip to content

Instantly share code, notes, and snippets.

@samtalks
Created October 2, 2013 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samtalks/6801630 to your computer and use it in GitHub Desktop.
Save samtalks/6801630 to your computer and use it in GitHub Desktop.
pigeons = []
pigeon_list = {}
pigeon_data.each {|props, vals| pigeon_data[props].
each {|prop, bird_set| pigeons += bird_set}}
pigeons.uniq!
pigeons.each do |pigeon|
pigeon_list[pigeon] = {:color => [], :gender => "", :lives => ""}
pigeon_data[:color].each do |color, bird_set|
pigeon_list[pigeon][:color] << color.to_s if bird_set.include?(pigeon)
end
pigeon_data[:gender].each do |gender, bird_set|
pigeon_list[pigeon][:gender] = gender.to_s if bird_set.include?(pigeon)
end
pigeon_data[:lives].each do |lives, bird_set|
pigeon_list[pigeon][:lives] = lives.to_s if bird_set.include?(pigeon)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment