Skip to content

Instantly share code, notes, and snippets.

/get_data.rb Secret

Created November 30, 2015 11:41
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 anonymous/0e35fd92740a7aba0e90 to your computer and use it in GitHub Desktop.
Save anonymous/0e35fd92740a7aba0e90 to your computer and use it in GitHub Desktop.
oktokit response parsing
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