Skip to content

Instantly share code, notes, and snippets.

@leejarvis

leejarvis/q.rb Secret

Created December 8, 2015 10:35
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 leejarvis/0cc2762546c36891abb8 to your computer and use it in GitHub Desktop.
Save leejarvis/0cc2762546c36891abb8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
questions = [
{
id: "textfield_13989925",
question: "First Name:"
}
]
answers = [
{
textfield_13989925: "John"
}
]
questions.each do |q|
id = q[:id].to_sym
answer = answers.find { |a| a[id] }
if answer
q.merge!(answer: answer[id])
end
end
p questions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment