Skip to content

Instantly share code, notes, and snippets.

@dekz
Created June 2, 2015 14:04
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 dekz/01b9bb8ea09244ae940d to your computer and use it in GitHub Desktop.
Save dekz/01b9bb8ea09244ae940d to your computer and use it in GitHub Desktop.
# Input
{ task_list: 1,
tasks:
[{:user=>"jacob", :task=>"feed cat", :id => 1},
{:user=>"jacob", :task=>"mow lawn", :id => 2},
{:user=>"steve", :task=>"feed lawn", :id => 1},
{:user=>"steve", :task=>"mow dog", :id => 2}]
}
# This seems possible
{ task_list: 1,
tasks:
[{:user=>"jacob", :tasks=>["feed cat", "mow lawn"]},
{:user=>"steve", :tasks=>["feed lawn", "mow dog"]}]
}
# This seems harder
{ task_list: 1,
tasks:
[{:user=>"jacob", :tasks=>[{ id: 1, task: "feed cat" }, { id: 2, task: "mow lawn"}]},
{:user=>"steve", :tasks=>[{ id: 1, task: "feed lawn" }, { id: 2, task: "mow dog" }]}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment