You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2013/02/25 20:23:01 UTC

[3/9] git commit: CIMI: Use class.superclass instead of opts[:class]

CIMI: Use class.superclass instead of opts[:class]

Under latest MRI 1.9.3 the 'opts[:class]' is not visible
to 'find' method and it is reported as 'method missing'

With 'class.superclass' we get access to the original class
we used to create Ref.

Signed-off-by: Michal fojtik <mf...@redhat.com>
TrackedAt: http://tracker.deltacloud.org/patch/a24aefe5f66b14b2be6fbc91c0eb2338c4f59a44


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/800695f4
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/800695f4
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/800695f4

Branch: refs/heads/master
Commit: 800695f4b5dd9e6ae96d8fe8127e76e52373b1e3
Parents: f6536de
Author: Michal Fojtik <mf...@redhat.com>
Authored: Fri Feb 22 13:36:22 2013 +0100
Committer: David Lutterkort <lu...@redhat.com>
Committed: Mon Feb 25 11:22:37 2013 -0800

----------------------------------------------------------------------
 server/lib/cimi/models/schema.rb |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/800695f4/server/lib/cimi/models/schema.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/schema.rb b/server/lib/cimi/models/schema.rb
index 215ebfc..3f8eb0f 100644
--- a/server/lib/cimi/models/schema.rb
+++ b/server/lib/cimi/models/schema.rb
@@ -189,7 +189,7 @@ class CIMI::Model::Schema
       if CIMI::Model::const_defined?(refname)
         @klass = CIMI::Model::const_get(refname)
       else
-        @klass = Class.new(opts[:class]) do
+        @klass = Class.new(opts[:class]) do |m|
           scalar :href
 
           def ref_id(ctx)
@@ -199,7 +199,11 @@ class CIMI::Model::Schema
           end
 
           def find(ctx)
-            opts[:class].find(ref_id(ctx), ctx)
+            klass.find(ref_id(ctx), ctx)
+          end
+
+          def klass
+            self.class.superclass
           end
         end
         CIMI::Model::const_set(refname, @klass)