-
-
Save anonymous/480bf9f18e98fd12020a196ff4dad7ca to your computer and use it in GitHub Desktop.
filter a nested hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user = {"id"=>97, "username"=>"bobbyl1000", "scores"=>[{"group_id"=>nil, "percentile_score"=>"0.3669724771"}, {"group_id"=>nil, "percentile_score"=>"0.3333333333"}, {"group_id"=>1, "percentile_score"=>"1.0"}, {"group_id"=>1, "percentile_score"=>"1.0"}], "avatar"=>{"url"=>"https://s3.amazonaws.com/gamepredict/assets/logo-.png", "profile"=>{"url"=>"https://s3.amazonaws.com/gamepredict/assets/logo-profile.png"}, "small"=>{"url"=>"https://s3.amazonaws.com/gamepredict/assets/logo-small.png"}}} | |
# I want to filter user so that it returns the exact hash, except the scores array should return only the hash that has "group_id" == 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment