1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[Cloudstack] 1.8.7 compat: on 1.8.7 '123'[0] returns the byte value of '0' and not '1'

This commit is contained in:
Frederick Cheung 2012-09-02 12:51:17 +01:00
parent 93812c2ffe
commit e519f9bd46

View file

@ -31,7 +31,7 @@ module Fog
# so dirty
def result
if successful? && model = Fog::Compute::Cloudstack.constants.find{|c| c.to_s.downcase == self.job_result.keys.first.to_s}.to_s
collection = model.gsub(/.[A-Z]/){|w| "#{w[0]}_#{w[1].downcase}"}.downcase + "s" # cheap underscorize, assume simple pluralization
collection = model.gsub(/.[A-Z]/){|w| "#{w[0,1]}_#{w[1,1].downcase}"}.downcase + "s" # cheap underscorize, assume simple pluralization
connection.send(collection).new(self.job_result.values.first)
else self.job_result
end