-
-
Save anonymous/0e35fd92740a7aba0e90 to your computer and use it in GitHub Desktop.
oktokit response parsing
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
ruby -le ' | |
data = [{:login=>"abcd", :foo => 1, :bar => 2}, {:login=>"xyz123", :foo => 2, :bar => 3 }] ## this is the data | |
logins = ["abcd", "xyz123", "foo"]; ## logins you want to search for | |
logins.each { ## loop through the logins | |
|l| # this is a login | |
p data.find { |h| h[:login] == l } # check to see if a hash with the value for login exists | |
} | |
' | |
__OUTPUT__ | |
{:login=>"abcd", :foo=>1, :bar=>2} | |
{:login=>"xyz123", :foo=>2, :bar=>3} | |
nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment