public
Created

  • Download Gist
my ruby problem...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Given this result set (this cannot be modified) that looks like:
 
[{"client name"=>"Adenbrook (Avalon Franchising Pty Ltd)", "job status wip c"=>"WIP", "job owner"=>"TCo", "job name"=>"INTR - 1300 Phone Charges 2010", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"ADN2611"}, {"client name"=>"Adenbrook Homes (Morris Family Building Trust)", "job status wip c"=>"WIP", "job owner"=>"NSe", "job name"=>"PREL: Fixed Display Centre: Port Macquarie", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"MBT2763"}, {"client name"=>"Media Shop", "job status wip c"=>"WIP", "job owner"=>"TCo", "job name"=>"Media Shop: Polypropylene folder - Contract & Documents", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"MED2801"}, {"client name"=>"Adenbrook Homes (Toolona NSW Pty Ltd)", "job status wip c"=>"WIP", "job owner"=>"CCo", "job name"=>"Media Shop: Tweed Richmond June 2010", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"ATR2817"}, {"client name"=>"Adenbrook (Avalon Franchising Pty Ltd)", "job status wip c"=>"WIP", "job owner"=>"CCo", "job name"=>"PREL: Adenbrook Customer Service Survey: Online Implementation", "job billable"=>nil, "__uid"=>#, "invoice lock"=>nil, "job no"=>"ADN986"}, {"client name"=>"Home Expert Centre", "job status wip c"=>"WIP", "job owner"=>"CCo", "job name"=>"PRNT: Home Expert Magazine: Small Format: Issue 3", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"MES2482"}, {"client name"=>"Adenbrook (Avalon Franchising Pty Ltd)", "job status wip c"=>"WIP", "job owner"=>"CCo", "job name"=>"DSGN: Adenbrook Homes: Guidelines Vehicle Brand: 2010", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"ADN2717"}]
 
I would like to create a hash that looks like (grouped by the job owner):
 
{ "TCo" => [
{"client name"=>"Adenbrook (Avalon Franchising Pty Ltd)", "job status wip c"=>"WIP", "job owner"=>"TCo", "job name"=>"INTR - 1300 Phone Charges 2010", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"ADN2611"},
{"client name"=>"Media Shop", "job status wip c"=>"WIP", "job owner"=>"TCo", "job name"=>"Media Shop: Polypropylene folder - Contract & Documents", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"MED2801"},
],
"NSe" => [
{"client name"=>"Adenbrook Homes (Morris Family Building Trust)", "job status wip c"=>"WIP", "job owner"=>"NSe", "job name"=>"PREL: Fixed Display Centre: Port Macquarie", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"MBT2763"}
]
"CCo" => [
{"client name"=>"Home Expert Centre", "job status wip c"=>"WIP", "job owner"=>"CCo", "job name"=>"PRNT: Home Expert Magazine: Small Format: Issue 3", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"MES2482"},
{"client name"=>"Adenbrook (Avalon Franchising Pty Ltd)", "job status wip c"=>"WIP", "job owner"=>"CCo", "job name"=>"DSGN: Adenbrook Homes: Guidelines Vehicle Brand: 2010", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"ADN2717"},
{"client name"=>"Adenbrook Homes (Toolona NSW Pty Ltd)", "job status wip c"=>"WIP", "job owner"=>"CCo", "job name"=>"Media Shop: Tweed Richmond June 2010", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"ATR2817"},
{"client name"=>"Adenbrook (Avalon Franchising Pty Ltd)", "job status wip c"=>"WIP", "job owner"=>"CCo", "job name"=>"PREL: Adenbrook Customer Service Survey: Online Implementation", "job billable"=>nil, "__uid"=>#, "invoice lock"=>nil, "job no"=>"ADN986"}
]
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.