incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH core] Added with_config method to client to allow switching drivers/providers using Ruby block syntax.
Date Mon, 17 Jan 2011 09:57:25 GMT
On 14/01/11 17:06 -0800, David Lutterkort wrote:
>ACK, couple comments:
>
>On Thu, 2011-01-13 at 11:25 +0100, mfojtik@redhat.com wrote:
>> From: Michal Fojtik <mfojtik@redhat.com>
>>
>> ---
>>  client/lib/deltacloud.rb |    9 +++++++++
>>  1 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
>> index 6985d5c..01cc2ca 100644
>> --- a/client/lib/deltacloud.rb
>> +++ b/client/lib/deltacloud.rb
>> @@ -77,6 +77,15 @@ module DeltaCloud
>>        yield self if block_given?
>>      end
>>
>> +    def with_config(opts, &block)
>
>Would be nice to document what goes into opts.

Agree, I'll put comment above.

>
>> +      api_instance = self.dup
>> +      api_instance.use_driver(opts[:driver],
>> +                             :username => opts[:username],
>> +                             :password => opts[:password],
>> +                             :provider => opts[:provider])
>> +      yield api_instance
>
>Isn't that missing a 'if block_given?' ?

You're right, I'll return api_instance in case that there is no block.


   -- Michal


-- 
--------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org
--------------------------------------------------------

Mime
View raw message