You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Tobias Crawley <tc...@redhat.com> on 2010/11/08 21:27:57 UTC

[PATCH 1/2] Move actual capability test out to its own method.

---
 server/lib/deltacloud/backend_capability.rb |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/server/lib/deltacloud/backend_capability.rb b/server/lib/deltacloud/backend_capability.rb
index bec8714..4e6b6a4 100644
--- a/server/lib/deltacloud/backend_capability.rb
+++ b/server/lib/deltacloud/backend_capability.rb
@@ -13,8 +13,12 @@ module Deltacloud::BackendCapability
     @capability = capability
   end
 
+  def has_capability?(backend)
+    !capability or backend.respond_to?(capability)
+  end
+  
   def check_capability(backend)
-    if capability and !backend.respond_to?(capability)
+    if !has_capability?(backend)
       raise Failure.new(capability, "#{capability} capability not supported by backend #{backend.class.name}")
     end
   end
-- 
1.7.2.3