You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by lu...@redhat.com on 2011/01/27 01:16:11 UTC

[PATCH] * lib/plain_formatter.rb (format): improve guessing the class of the formatter

From: David Lutterkort <lu...@redhat.com>

Before, running 'deltacloudc realms' would raise the exception

  ./lib/plain_formatter.rb:81:in `const_get': wrong constant name Base::Realm
---
 client/lib/plain_formatter.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/lib/plain_formatter.rb b/client/lib/plain_formatter.rb
index e17a5e6..cc75ec1 100644
--- a/client/lib/plain_formatter.rb
+++ b/client/lib/plain_formatter.rb
@@ -77,7 +77,7 @@ module DeltaCloud
     end
 
     def format(obj)
-      object_name = obj.class.name.classify.gsub(/^DeltaCloud::API::/, '')
+      object_name = obj.class.name.classify.gsub(/^.*::/, '')
       format_class = DeltaCloud::PlainFormatter::FormatObject.const_get(object_name)
       format_class.new(obj).format
     end
-- 
1.7.3.5


Re: [PATCH] * lib/plain_formatter.rb (format): improve guessing the class of the formatter

Posted by Michal Fojtik <mf...@redhat.com>.
On 26/01/11 16:16 -0800, lutter@redhat.com wrote:

Good catch David! ACK.

   -- Michal

>From: David Lutterkort <lu...@redhat.com>
>
>Before, running 'deltacloudc realms' would raise the exception
>
>  ./lib/plain_formatter.rb:81:in `const_get': wrong constant name Base::Realm
>---
> client/lib/plain_formatter.rb |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/client/lib/plain_formatter.rb b/client/lib/plain_formatter.rb
>index e17a5e6..cc75ec1 100644
>--- a/client/lib/plain_formatter.rb
>+++ b/client/lib/plain_formatter.rb
>@@ -77,7 +77,7 @@ module DeltaCloud
>     end
>
>     def format(obj)
>-      object_name = obj.class.name.classify.gsub(/^DeltaCloud::API::/, '')
>+      object_name = obj.class.name.classify.gsub(/^.*::/, '')
>       format_class = DeltaCloud::PlainFormatter::FormatObject.const_get(object_name)
>       format_class.new(obj).format
>     end
>--
>1.7.3.5
>

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