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 2013/03/14 01:33:33 UTC

[PATCH 01/14] CIMI Models: rename hash in DSL to hash_map

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

Since 'hash' is used for putting objects into Hash, overriding it as a
class method causes surprises when a class is used as a hash key.
---
 server/lib/cimi/models/base.rb            | 2 +-
 server/lib/cimi/models/schema.rb          | 2 +-
 server/lib/cimi/models/system_template.rb | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/lib/cimi/models/base.rb b/server/lib/cimi/models/base.rb
index e8c1104..a207bed 100644
--- a/server/lib/cimi/models/base.rb
+++ b/server/lib/cimi/models/base.rb
@@ -121,7 +121,7 @@ module CIMI::Model
     # Common attributes for all resources
     #
     text :id, :name, :description, :created, :updated
-    hash :property
+    hash_map :property
 
     def initialize(values = {})
       super(values)
diff --git a/server/lib/cimi/models/schema.rb b/server/lib/cimi/models/schema.rb
index 4ce16b9..b4e9377 100644
--- a/server/lib/cimi/models/schema.rb
+++ b/server/lib/cimi/models/schema.rb
@@ -461,7 +461,7 @@ class CIMI::Model::Schema
       add_attributes!([name, opts], Ref)
     end
 
-    def hash(name)
+    def hash_map(name)
       add_attributes!([name, {}], Hash)
     end
 
diff --git a/server/lib/cimi/models/system_template.rb b/server/lib/cimi/models/system_template.rb
index 09cd9b0..6a6e1f2 100644
--- a/server/lib/cimi/models/system_template.rb
+++ b/server/lib/cimi/models/system_template.rb
@@ -19,7 +19,7 @@ class CIMI::Model::SystemTemplate < CIMI::Model::Base
 
   array :component_descriptors do
     text :name, :description
-    hash :properties
+    hash_map :properties
     text :type
     #component_template, comprises:
 #    struct :machine_template, :class => CIMI::Model::MachineTemplate
-- 
1.8.1.4