Revision aaccdf92 src/sunstone/models/OpenNebulaJSON/JSONUtils.rb

View differences:

src/sunstone/models/OpenNebulaJSON/JSONUtils.rb
113 113

  
114 114
             str
115 115
         end
116

  
117
         def hash_to_str(template_hash, delete_values)
118
            for del in delete_values
119
                template_hash.delete(del)
120
            end
121

  
122
            if !template_hash.empty?
123
                template_str = ""
124
                template_hash.collect do |key,value|
125
                    if value.kind_of?(Array)
126
                        template_str << key.to_s.upcase << " = \["
127
                        for obj in value
128
                            if obj.kind_of?(Hash)
129
                                obj.collect do |key,value|
130
                                    template_str << key.to_s.upcase << " = \""<< value.to_s << "\"\n"
131
                                end
132
                            end
133
                        end
134
                        template_str << "\]\n"
135
                    else
136
                        template_str << key.to_s.upcase << " = \""<< value.to_s << "\"\n"
137
                    end
138
                end
139
            end
140
            return template_str
141
        end
116 142
     end
117 143
end

Also available in: Unified diff