Reputation: 13467
I have a UUID with three unique properties for each UUID. I want to store all these. I know I need a hash inside a hash, but I am having trouble doing this.
It's creating them inside a loop, and for each iteration I need to append/add it to the hash, so I'm not sure how to do that either.
19ee480015a2012f0aeb64ce8f2f69f4:
status: complete
name: SaveComment
pct_complete: 100
083732301597012f0aea64ce8f2f69f4:
status: working
name: SaveComment
pct_complete: 35
bf40ca301596012f0ae864ce8f2f69f4:
status: complete
name: SaveComment
pct_complete: 100
This is the code it's going into:
get '/percentcomplete' do
progress = {}
Resque::Status.status_ids.each do |uuid|
active_status = Resque::Status.get(uuid)
#update hash each loop here with name, status, pct_complete, and uuid
end
end
Upvotes: 0
Views: 217
Reputation: 5914
Assuming we can get name, status, pct_complete from active_status object,
get '/percentcomplete' do
progress = {}
Resque::Status.status_ids.each do |uuid|
active_status = Resque::Status.get(uuid)
#update hash each loop here with name, status, pct_complete, and uuid
progress[uuid.to_s] = {:name => active_status.name,
:status => active_status.status,
:ptc_complete => active_status.ptc_complete}
end
end
Upvotes: 1