Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >> test = { 1=>25, 2=>30, 5=>100 }
- => {1=>25, 2=>30, 5=>100}
- >> test2 = []
- => []
- >> test.each { |key,value| test2.push({ "device"=> key.to_s, "diskImage" => { "capacity" => value.to_s } }) }
- => {1=>25, 2=>30, 5=>100}
- >> test2
- => [{"device"=>"1", "diskImage"=>{"capacity"=>"25"}}, {"device"=>"2", "diskImage"=>{"capacity"=>"30"}}, {"device"=>"5", "diskImage"=>{"capacity"=>"100"}}]
Advertisement
Add Comment
Please, Sign In to add comment