incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r962366 - /incubator/deltacloud/trunk/client/lib/deltacloud.rb
Date Thu, 08 Jul 2010 23:49:49 GMT
Author: lutter
Date: Thu Jul  8 23:49:49 2010
New Revision: 962366

URL: http://svn.apache.org/viewvc?rev=962366&view=rev
Log:
Fixed method rewriting in client

Modified:
    incubator/deltacloud/trunk/client/lib/deltacloud.rb

Modified: incubator/deltacloud/trunk/client/lib/deltacloud.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/lib/deltacloud.rb?rev=962366&r1=962365&r2=962366&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/lib/deltacloud.rb (original)
+++ incubator/deltacloud/trunk/client/lib/deltacloud.rb Thu Jul  8 23:49:49 2010
@@ -199,16 +199,15 @@ module DeltaCloud
                   end
                 # Public and private addresses are returned as Array
                 when "public_addresses", "private_addresses":
-                  define_method :"#{attribute.name.sanitize}" do
-                    attribute.xpath('address').collect { |address| address.text }
-                  end
+                  attr_accessor :"#{attribute.name.sanitize}"
+                  obj.send(:"#{attribute.name.sanitize}=",
+                    attribute.xpath('address').collect { |address| address.text })
                 # Value for other attributes are just returned using
                 # method with same name as attribute (eg. .owner_id, .state)
                 else
-                  define_method :"#{attribute.name.sanitize}" do
-                    attribute.text.convert
-                  end
-                  logger << "[DC] Added method #{attribute.name} to #{obj.class.name}\n"
+                  attr_accessor :"#{attribute.name.sanitize}"
+                  obj.send(:"#{attribute.name.sanitize}=", attribute.text.convert)
+                  logger << "[DC] Added method #{attribute.name}[#{attribute.text}]
to #{obj.class.name}\n"
               end
             end
           end



Mime
View raw message