deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [3/9] git commit: CIMI: Use class.superclass instead of opts[:class]
Date Mon, 25 Feb 2013 19:23:01 GMT
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 <mfojtik@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 <mfojtik@redhat.com>
Authored: Fri Feb 22 13:36:22 2013 +0100
Committer: David Lutterkort <lutter@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)


Mime
View raw message