-
-
Save rbirnie/510312edf3d4f2d90361 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.9.3-p484 :082 > a = [{"persistent"=>true,"format_type"=>"raw","name"=>"fog-492279386986572","capacity"=>"10G","allocation"=>"0G","id"=>"","pool_name"=>"VolGroup00"}] | |
=> [{"persistent"=>true, "format_type"=>"raw", "name"=>"fog-492279386986572", "capacity"=>"10G", "allocation"=>"0G", "id"=>"", "pool_name"=>"VolGroup00"}] | |
1.9.3-p484 :083 > a.map! do |volume| | |
1.9.3-p484 :084 > if volume.instance_of?(Hash) && volume[:id].present? | |
1.9.3-p484 :085?> volume | |
1.9.3-p484 :086?> elsif volume.instance_of?(Hash) | |
1.9.3-p484 :087?> volume.reject! { |k, v| k == :id } | |
1.9.3-p484 :088?> end | |
1.9.3-p484 :089?> end | |
=> [nil] | |
Should be: | |
=> [{"persistent"=>true, "format_type"=>"raw", "name"=>"fog-492279386986572", "capacity"=>"10G", "allocation"=>"0G", "pool_name"=>"VolGroup00"}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment