On Wed, 2012-08-08 at 11:24 +0200, [email protected] wrote: > From: Michal Fojtik <[email protected]> > > * When the driver inherits its methods from other driver, > the has_capability failed to find them, which cause to > not advertise them. > > Signed-off-by: Michal fojtik <[email protected]> > --- > server/lib/deltacloud/drivers/base_driver.rb | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-)
ACK; minor nit: > diff --git a/server/lib/deltacloud/drivers/base_driver.rb > b/server/lib/deltacloud/drivers/base_driver.rb > index 21e4382..30d0f92 100644 > --- a/server/lib/deltacloud/drivers/base_driver.rb > +++ b/server/lib/deltacloud/drivers/base_driver.rb > @@ -157,7 +157,11 @@ module Deltacloud > > def has_capability?(method) > method = (RUBY_VERSION =~ /^1\.9/) ? method : method.to_s > - (self.class.instance_methods - > self.class.superclass.instance_methods).include? method > + # Prevent has_capability fail when driver is inherited from another > + # driver, like Eucalyptus > + superclass_methods = self.class.superclass.name == > 'Deltacloud::BaseDriver' ? Why compare by name here instead of self.class.superclass == Deltacloud::BaseDriver ? Why is has_capability? not just an alias for respond_to? ? Where we use it, it seems, we only check for methods that aren't defined in the base_driver anyay. So maybe we don't need all these superclass complications. David
